springdoc-openapi-maven-plugin icon indicating copy to clipboard operation
springdoc-openapi-maven-plugin copied to clipboard

Will the plugin generate multiple files if GroupedOpenAPI is used?

Open lfvjimisola opened this issue 2 years ago • 3 comments

Will the plugin generate multiple files if GroupedOpenAPI is used?

It does not look like it in the source code: here or here

And if so, how are the filenames generated? openapi-.<json|yaml>

lfvjimisola avatar Oct 06 '23 15:10 lfvjimisola

Hey, I also needed the plugin to generate multiple files for each GroupedOpenApi so what I did using maven was something like this:

  • I defined 2 GroupedOpenApi: public and private

  • I changed the plugin to execute each group on it's own:

        <plugin>
               <groupId>org.springdoc</groupId>
               <artifactId>springdoc-openapi-maven-plugin</artifactId>
               <version>1.4</version>
               <executions>
                   <execution>
                       <id>public-openapi</id>
                       <goals>
                           <goal>generate</goal>
                       </goals>
                       <configuration>
                           <apiDocsUrl>http://server:port/context-path/v3/api-docs/public</apiDocsUrl>
                           <outputFileName>openapi-public.yaml</outputFileName>
                           <outputDir>${project.basedir}/src/main/</outputDir>
                           <skip>false</skip>
                       </configuration>
                   </execution>
                   <execution>
                       <id>admin-openapi</id>
                       <goals>
                           <goal>generate</goal>
                       </goals>
                       <configuration>
                           <apiDocsUrl>http://server:port/context-path/v3/api-docs/private</apiDocsUrl>
                           <outputFileName>openapi-admin.yaml</outputFileName>
                           <outputDir>${project.basedir}/src/main/</outputDir>
                           <skip>false</skip>
                       </configuration>
                   </execution>
               </executions>
           </plugin>

Hope it helps

cristian-daramus avatar Oct 13 '23 07:10 cristian-daramus

Thanks, but we need a solution that is dynamic (in terms of number of APIs) rather than hardcoded.

lfvjimisola avatar Oct 13 '23 07:10 lfvjimisola

Possible duplicate of https://github.com/springdoc/springdoc-openapi/issues/2539

codespearhead avatar Apr 01 '24 16:04 codespearhead