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

Plain JS object as apiSpec in constructor #9

Closed
sheldhur opened this issue Jun 28, 2019 · 4 comments
Closed

Plain JS object as apiSpec in constructor #9

sheldhur opened this issue Jun 28, 2019 · 4 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@sheldhur
Copy link
Collaborator

sheldhur commented Jun 28, 2019

Hi. Can you add support plain JS object as apiSpec in constructor?

It would be useful if you use jsdoc annotations for writing swagger\openapi spec or if you split yor spec on small simpled parts (js or json) and build big yaml when app starts.

@cdimascio
Copy link
Owner

hi @sheldhur thanks for the suggestion. could you elaborate a bit on what you are looking for? perhaps provide an example of what you are thinking. i'll certainly consider. thanks!

@sheldhur
Copy link
Collaborator Author

sheldhur commented Jul 4, 2019

@cdimascio like this

const apiSpec = {
  openapi: "3.0.0",
  info: {...},
  servers: [...],
  paths: {...},
  components: {
    responses: {...},
    schemas: {...}
  }
}
new OpenApiValidator({apiSpec}).install(app);

@cdimascio
Copy link
Owner

got it. yes, something like this can certainly be supported. i'll look into it. thanks

@cdimascio cdimascio added enhancement New feature or request good first issue Good for newcomers labels Jul 4, 2019
@cdimascio
Copy link
Owner

@sheldhur this is now implemented in express-openapi-validator@1.2.0.
Thanks for the suggestion!

@cdimascio cdimascio self-assigned this Jul 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants