Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model classes not detected. #867

Open
mdros opened this issue Jul 28, 2021 · 0 comments
Open

Model classes not detected. #867

mdros opened this issue Jul 28, 2021 · 0 comments

Comments

@mdros
Copy link

mdros commented Jul 28, 2021

Hello everyone,
I have a following problem: I have a package containing classes, which are written in plain java - the only annotations are from Lombok - and I wanted to document them as models inside yaml file. Is it possible and I am configuring something in the wrong way, or is the plugin not suitable for my case.

  <plugin>
      <groupId>com.github.kongchen</groupId>
      <artifactId>swagger-maven-plugin</artifactId>
      <version>3.1.8</version>
      <configuration>
          <apiSources>
              <apiSource>
                  <springmvc>false</springmvc>
                  <locations>
                      <location>com.sabre.tripcase.tcp.corporation.v2.model</location>
                  </locations>
                  <info>
                      <title>Test</title>
                      <version>1.0</version>
                  </info>
                  <swaggerDirectory>${project.build.directory}/swagger</swaggerDirectory>
                  <attachSwaggerArtifact>true</attachSwaggerArtifact>
                  <outputFormats>yaml</outputFormats>
              </apiSource>
          </apiSources>
      </configuration>
      <executions>
          <execution>
              <phase>compile</phase>
              <goals>
                  <goal>generate</goal>
              </goals>
          </execution>
      </executions>
  </plugin>

Here's the configuration, and here's an example of a file I want to document:

@ApiModel
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class CorporationRQ {

    @ApiModelProperty(value = "name")
    private String name;
    @ApiModelProperty(value = "parentUUID")
    private UUID parentUUID;
    @ApiModelProperty(value = "mapping")
    private List<Mapping> mapping;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public UUID getParentUUID() {
        return parentUUID;
    }

    public void setParentUUID(UUID parentUUID) {
        this.parentUUID = parentUUID;
    }

    public List<Mapping> getMapping() {
        return mapping;
    }

    public void setMapping(List<Mapping> mapping) {
        this.mapping = mapping;
    }

}

When I launch the plugin through mvn compile, I get the following result:

---
swagger: "2.0"
info:
  version: "1.0"
  title: "Test"

I tried chaning @ApiModel to @Api with no success.
Thanks for help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant