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

Expose swagger/openapi version for transform hook #737

Closed
2 tasks done
samchungy opened this issue Jul 2, 2023 · 4 comments · Fixed by #739
Closed
2 tasks done

Expose swagger/openapi version for transform hook #737

samchungy opened this issue Jul 2, 2023 · 4 comments · Fixed by #739
Labels
feature request New feature to be added good first issue Good for newcomers

Comments

@samchungy
Copy link
Contributor

samchungy commented Jul 2, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Add the openapi/swagger version to transform hook parameters. Unless there is a way to access the options passed into a plugin..?

Motivation

I need to know what version of schema I am creating otherwise I may transform the schema into something that is incompatible.

Example

transform: ({ schema, url, version }) => {
  if (version === '3.0.3') {
    // generate 3.0.3 schema
  }
}
@mcollina
Copy link
Member

mcollina commented Jul 3, 2023

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@mcollina mcollina added feature request New feature to be added good first issue Good for newcomers labels Jul 3, 2023
@Uzlopak
Copy link
Contributor

Uzlopak commented Jul 3, 2023

we should maybe pass the whole options object to transform. version is too unspecific. In #732 it is requested to access the constraint, which also could contain version. Then people could get confused which version we actually mean. So better to pass config/options and constraints

@Liam-Tait
Copy link
Contributor

@mcollina I think this is a duplicate of #732 which I have made a pr for

@samchungy
Copy link
Contributor Author

samchungy commented Jul 3, 2023

@mcollina I think this is a duplicate of #732 which I have made a pr for

Slightly different. I'm looking for the swagger/openapi version as opposed to the API version which is different.

@Uzlopak makes a good point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature to be added good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants