Use new Spring HTTP Interface with Spring Code Gen - Open API generator

254 Views Asked by At
Description

Hi every one, I am recently working in migrate the version of plugin. I want to use spring http interface for client generations. in my last version of my custom project generator I was using retrofit2.

In 6.6.0 version I see that in libraries the project has spring http interface, but in my pom of my project how i can set librarie for use this new library.

In my client it's generating annotation with retrofit @POST and I wanna use @PostExchange from spring http interface for my clients operations

openapi-generator version

I am migrating my custom project from 4.3.1 to 6.6.0 of plugin generator

OpenAPI declaration file content or url

I set in my pom in my last version, I don't know how to set for use new libraries of spring http interface and use new annotations for my operation of my client.

  <configuration>
              <inputSpec>${project.basedir}/src/main/resources/openapi-clientcontract.yaml</inputSpec>
              <library>retrofit2</library>
  </configuration>
Command line used for generation
Steps to reproduce

Not applied

Related issues/PRs

Not applied

Suggest a fix/enhancement

Not applied

I try to set in library configuration name of package of spring http interface. but i have this exception enter image description here

1

There are 1 best solutions below

0
qwerty1423 On

You probably have wrong generatorName defined in plugin execution. Looks like you have java instead of spring. Should look like this:

<plugin>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>generate-sources-something</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <generatorName>spring</generatorName>
                ...
            </configuration>
        </execution>
    </executions>
</plugin>