Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8545
Closed
Open
Issue created Jan 26, 2021 by Administrator@rootContributor

[REQ][Spring] Be able to filter with API version

Created by: Zomzog

Is your feature request related to a problem? Please describe.

I need to generate multiple versions of an API handled by the same service. The version can be provided by a custom header or a custom query param. So I can't use Media-type tricks.

My need is to use the spring capacity of filtering (example can be found here).

This will allow us to generate and deploy each version of each contract without conflict and manage.

Describe the solution you'd like

I want to be able to do something like this

            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>5.0.1-SNAPSHOT</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>src/main/resources/openapi.yaml</inputSpec>
                            <generatorName>spring</generatorName>
                            <apiPackage>org.openapitools.api</apiPackage>
                            <modelPackage>org.openapitools.model</modelPackage>
                            <generateSupportingFiles>false</generateSupportingFiles>
                            <configOptions>
                                <versionType>HEADER</versionType>
                                <versionToken>X-CUSTOM-VERSION</versionToken>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

and get

    @GetMapping(
        value = "/ponies",
        produces = { "application/json" },
        headers = "X-CUSTOM-VERSION=1.0.0"
    )

Describe alternatives you've considered

Media-type and path have been excluded. I don't manage to specify this kind of filtering directly in the OAS3 file.

Additional context

Assignee
Assign to
Time tracking