Skip to content

Cannot disable validation annotations #1766

@alkismavridis

Description

@alkismavridis

Issue Description

By default, jakarda validation annotations get created. In my case though, I neither have the jakarta dependency nor do I actually need it. Using Jspecify is also out of the question since, as mentioned here, it does not compile.

I would like to disable the annotation feature completely but here seems to be no way to do this. Using an empty does not work - the code is still generated with jakarta annotations.

I use version 5.10.0

Steps to Reproduce

Create a maven project without jakarta validations dependency. Try to disable annotations

			<plugin>
				<groupId>io.github.kobylynskyi</groupId>
				<artifactId>graphql-codegen-maven-plugin</artifactId>
				<version>5.10.0</version>
				<executions>
					<execution>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<graphqlSchemaPaths>
								<graphqlSchemaPath>${project.basedir}/src/main/resources/graphql/schema.graphqls</graphqlSchemaPath>
							</graphqlSchemaPaths>
							<outputDir>${project.basedir}/target/generated-sources/graphql</outputDir>
							<packageName>my.company.api.graphqlmodel</packageName>
							<generateImmutableModels>true</generateImmutableModels>
							<modelValidationAnnotation /> <!-- any special value to indicate "no annotations" is also welcome-->
						</configuration>
					</execution>
				</executions>
			</plugin>

Expected Result

No annotations get created for non-null fields

Actual Result

Jakarta annotations get created for non-null fields

Your Environment and Setup

  • graphql-java-codegen version: 5.10.0
  • Build tool: Maven/
  • Mapping Config: posted above

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions