Skip to content

Support GAV coordinates for "input-base-dir" #1340

@michaelsonnleitner

Description

@michaelsonnleitner

Tell us the extension to which you'd like to add the feature.

Client

What kind of feature would you like to add?

Currently it is only possible to define a directory where the rest-client generator looks for openapi.yaml files.

It is a common usecase that companies store their openapi-specifications of services in a company-central maven repository. So anyone can consume openapi.yaml specifications form there.

It would be nice to reference one or multiple GAV coordinates during configuration for client generation.

Proposal(s):

Maybe an implementation like https://github.com/quarkiverse/quarkus-openapi-generator/blob/main/client/integration-tests/generation-input/src/main/java/io/quarkiverse/openapi/generator/codegen/ClassPathPetstoreOpenApiSpecInputProvider.java could be provided (e.g. GAVCoordinateOpenApiSpecInputProvider)

Alternative(s):

I know this could be done via maven plugin executions (but is a lot of xml config), and I think it is much more straight forward to define this somehow in the application.properties file.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <goal>copy</goal>
            <phase>initialize</phase>
        </execution>
    </executions>
    <configuration>
        <artifactItems>
            <artifactItem>
                <artifactId>com.company</artifactId>
                <groupId>person-service</groupId>
                <version>1.0.0</version>
                <type>yaml</type>
            </artifactItem>
            <artifactItem>
                <artifactId>com.company</artifactId>
                <groupId>payment-service</groupId>
                <version>1.0.0</version>
                <type>yaml</type>
            </artifactItem>
        </artifactItems>
        <outputDirectory>${project.basedir}/target/input-base-dir</outputDirectory> <!-- generate this clients after copy -->
        <stripVersion>true</stripVersion>
        <prependGroupId>true</prependGroupId>
    </configuration>
</plugin>

Additional info:

service part is publishing the openapi.yaml with following maven command:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <executions>
        <execution>
            <id>install-file</id>
            <goals>
                <goal>install-file</goal>
            </goals>
            <phase>install</phase>
        </execution>
    </executions>
    <configuration>
        <artifactId>com.company</artifactId>
        <groupId>person-service</groupId>
        <version>1.0.0</version>
        <file>somewhere/openapi.yaml</file>
        <packaging>yaml</packaging>
    </configuration>
</plugin>

Community Notes

  • Please vote by adding a 👍 reaction to the feature to help us prioritize.
  • If you want to work on this feature, please leave a comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clientThis item is related to the client extension

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions