Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Openapi operationid is repeated

I'm using Open-API to generate java class using yaml file. when i run

mvn clean install

i'm getting this error :

unexpected error in Open-API generation
org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 3, Warning count: 6
Errors: 
    -attribute paths.'/path/{id}'(delete).operationId is repeated
    -attribute paths.'/path/name'(get).operationId is repeated

How can i skeep this validation ?

like image 435
Hamza Avatar asked May 11 '26 12:05

Hamza


2 Answers

For me, the correct place of validateSpec was configuration instead of configOptions

<plugin>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <version>6.2.1</version>
    <executions>
        <execution>
            <id>abc-api</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                ...
                <validateSpec>false</validateSpec>
                <skipValidateSpec>true</skipValidateSpec>
                <configOptions>
                    <developerOrganization>ABC</developerOrganization>
                    ...
                </configOptions>
            </configuration>
        </execution>
    </executions>
</plugin>

Note: I have to add both validateSpec and skipValidateSpec for version 6.2.1 as per suggestion in an open bug https://github.com/OpenAPITools/openapi-generator/issues/9815

like image 104
Shaman Virk Avatar answered May 14 '26 03:05

Shaman Virk


for Version 7.1.0

<skipValidateSpec>true</skipValidateSpec>

did the trick

                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>7.1.0</version>
                <executions>
                    <execution>
                        <id>generate-client-code</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <skipValidateSpec>true</skipValidateSpec>
                            (....)
                        </configuration>
                    </execution>
like image 36
gratinierer Avatar answered May 14 '26 03:05

gratinierer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!