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

How to generate classes with @NotNull and @Valid annotations from Jakarta #270

Open
alexalmeida52 opened this issue Apr 25, 2024 · 0 comments

Comments

@alexalmeida52
Copy link

I expected that when using the plugin, classes with Jakarta annotations would be generated. For example, a parameter that cannot be null would have the @NotNull annotation in the generated class and this would be validated.

However, I'm encountering the class being generated with comments about the attribute that serve no purpose.

For example, I have a "name" attribute that is required and in the generated class it is presented like this:

/**
  *
  * (Required)
  *
  */
@JsonProperty("name")
private String name;

Is it possible to generate with these Jakarta Validation annotations? If so, how to configure the maven plugin to achieve this result.

Below is my current configuration:

<plugin>
    <groupId>io.apicurio</groupId>
    <artifactId>apicurio-codegen-maven-plugin</artifactId>
    <version>${apicurio-codegen-maven.version}</version>
    <executions>
        <execution>
            <id>generate-tpfee-resources</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <projectSettings>
                    <javaPackage>org.acme.application.rest.resources
                    </javaPackage>
                </projectSettings>
                <inputSpec>src/main/resources/api.json</inputSpec>
                <outputDir>./src/main/java/</outputDir>
            </configuration>
        </execution>
    </executions>
</plugin>
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