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

add support for multi server #237

Closed
wants to merge 1 commit into from

Conversation

cyb3rs4pi3n
Copy link

@cyb3rs4pi3n cyb3rs4pi3n commented Apr 26, 2020

Addresses #236

Checklist

  • run npm run test and npm run benchmark
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message and code follows Code of conduct

@mcollina
Copy link
Member

This is missing docs and tests. I do not know which other features are missing between swagger and openapi, so I would be cautious.

@@ -59,7 +60,7 @@ module.exports = function (fastify, opts, next) {
// Base swagger info
// this info is displayed in the swagger file
// in the same order as here
swaggerObject.swagger = '2.0'
servers ? swaggerObject.openapi = '3.0.0' : swaggerObject.swagger = '2.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OAS 3.0 is not supported by this plugin and so the servers syntax.

So this change would not be enough to support it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true. It worked for my use-case but as mcollina pointed out, this has to be thoroughly accounted for all the features that may be in use in the swagger 2.0 [currently looking into it]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was analysing how to solve the $ref, and I found this module @apidevtools/swagger-parser.

I think it could be useful to check the difference between the OAS2 and OAS3 formats.

Then, I thought what could be the macro-steps for this:

  1. collect all the schemas
  2. build one single schema (I working on it to support $ref and shared schemas)
  3. translate a JSON schema (draft 07 - since draft2019 is not broadly supported yet) to Swagger/OAS2.0 or OAS3 based on user options
  4. validate the generated OAS object
  5. render it

@climba03003 climba03003 mentioned this pull request Jan 11, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants