Coder Social home page Coder Social logo

Comments (5)

vthanikachalam avatar vthanikachalam commented on September 23, 2024

Please note as part of Enterprise automation we would like to build the JSON specification during build lifecycle, I tried using swagger-maven-plugin to generate JSON file.. plugin configuration is as follows...

        <plugin>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-maven-plugin</artifactId>
            <version>2.0.5</version>
            <configuration>
                <outputFileName>registrationAPI-2</outputFileName>
                <outputPath>${basedir}/target/</outputPath>
                <outputFormat>JSON</outputFormat>
                <resourcePackages>
                    <resourcePackage>com.altais.registration.controller</resourcePackage>
                </resourcePackages>
                <prettyPrint>true</prettyPrint>
            </configuration>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>resolve</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

when I ran the build, it generates 'registrationAPI-1.json' with a header element. It's incomplete does not have anything.. attached the file for reference

registrationAPI-2.json.txt

please advice to proceed further.

from swaggerhub-maven-plugin.

webron avatar webron commented on September 23, 2024

@vthanikachalam Can you provide us with more information about your Java project? Which framework do you use for your API? Is it JAX-RS based or Spring based?

from swaggerhub-maven-plugin.

vthanikachalam avatar vthanikachalam commented on September 23, 2024

It's Spring boot application, after running the application we could able to generate REST API documentation/schema by hitting/launching the URL http://localhost:port/application-context/v2/api-docs in the browser

But we would like to generate the REST API documentation/schema without running the application, we want to make use of the swagger-maven-plugin

Followed the step provided in the URL https://github.com/SmartBear/swaggerhub-maven-plugin but it did not work, it generates a kind of empty file

Please provide your support

from swaggerhub-maven-plugin.

webron avatar webron commented on September 23, 2024

https://github.com/SmartBear/swaggerhub-maven-plugin (this project) is intended to interact with SwaggerHub using existing files or files that are being generated during the build process. It does not generate an API definition from your code.

The swagger-maven-plugin that's mentioned in the documentation, and what you shared above, only works with JAX-RS based APIs and not Spring ones. We do not provide a solution for Spring-based APIs ourselves. Depending on the library you use in Spring (whether it's Springfox or Springdocs) and depending on the version, there may be other solutions out there for compile-time generation of the API definition. Unfortunately, it is out of scope for what we provide.

from swaggerhub-maven-plugin.

barryadk avatar barryadk commented on September 23, 2024

Closing issue as it is not related to the swaggerhub-maven-plugin project.
It is a question for swagger-maven-plugin:
https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-maven-plugin

from swaggerhub-maven-plugin.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.