Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAPI validation appears to not be working #1537

Closed
rschelling opened this issue Jul 23, 2024 · 3 comments · Fixed by #1584
Closed

OpenAPI validation appears to not be working #1537

rschelling opened this issue Jul 23, 2024 · 3 comments · Fixed by #1584
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@rschelling
Copy link

What are the steps to reproduce this issue?

  1. Enable validation: true in the input configuration.
  2. Use Orval to generate typescript from an OpenAPI JSON file

What happens?

I had an error in my OpenAPI specification and Orval did generate invalid type declaration (The property name was there, but the actual type was missing).
Even after enabling validation, Orval still generated the invalid typescript code.

The part in the OpenAPI File looked like this:

"whiteBalanceSettingsLeft": {
  "oneOf": [],
  "discriminator": {
    "propertyName": "type",
    "mapping": {}
  }
},

And the generated type was:

whiteBalanceSettingsLeft: ;

Afterwards i used the IBM OpenAPI Validator without any custom configuration and it detected that error and also a lot of others regarding the wrong casing for parameter names, etc.

What were you expecting to happen?

I expected Orval to through an error and not generate invalid typescript code.

Any other comments?

I would appreciate it, if you could tell me, if this is the expected behaviour and if i should validate the OpenAPI file before using Orval. Thanks!

What versions are you using?

Operating System: Ubuntu
Package Version: 6.31.0
Browser Version:

@melloware melloware added bug Something isn't working help wanted Extra attention is needed labels Jul 23, 2024
@melloware
Copy link
Collaborator

I would have expected this to validate so this is a bug.

@melloware
Copy link
Collaborator

@rschelling the code is right here if you want to debug and help us fix it?

https://github.com/orval-labs/orval/blob/master/packages/core/src/utils/validator.ts

@rschelling
Copy link
Author

@melloware I will take a look at it and see what i can do, but no promises :-)

@melloware melloware changed the title Orval's input validation appears to not be working OpenAPI validation appears to not be working Jul 24, 2024
@melloware melloware added this to the 7.0.2 milestone Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
2 participants