Skip to content

Commit

Permalink
chore: adjust variable names and version number
Browse files Browse the repository at this point in the history
  • Loading branch information
CarstenWickner committed Jan 14, 2025
1 parent 8f6f2a1 commit 214b262
Show file tree
Hide file tree
Showing 19 changed files with 70 additions and 69 deletions.
1 change: 0 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ jobs:
- name: Autobuild
uses: github/codeql-action/autobuild@v2


- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
java-version: ['17']
java-version: ['17', '21']

steps:
- uses: actions/checkout@v3
Expand All @@ -37,7 +37,7 @@ jobs:

strategy:
matrix:
java-version: ['17']
java-version: ['17', '21']

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### `jsonschema-generator`
#### Changed
- BREAKING: drop support for JDK 11 in favor of JDK 17
- avoid duplicate entries in `required` array when performing final clean-ups

## [4.37.0] - 2024-11-11
Expand Down
2 changes: 1 addition & 1 deletion jsonschema-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-parent</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-parent/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-examples</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions jsonschema-generator-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-bom</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<maven.compiler.release>17</maven.compiler.release>
<signAndStage.skip>true</signAndStage.skip>
</properties>

Expand Down
15 changes: 10 additions & 5 deletions jsonschema-generator-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-bom</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-bom/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-generator-parent</artifactId>
Expand Down Expand Up @@ -61,7 +61,7 @@
<role>Provided PRs #116 and #118 (part of initial Swagger2Module)</role>
<role>Provided implementation for #204 (readOnly/writeOnly in JacksonModule)</role>
<role>Provided PR #299 and feedback on final implementation (inheritance of validation constraint annotations)</role>
<role>Provided implementation for PR #503 (avoid duplicates in required array during final clean-ups)</role>
<role>Provided PR #503 (avoid duplicates in required array during final clean-ups)</role>
</roles>
</contributor>
<contributor>
Expand Down Expand Up @@ -137,13 +137,18 @@
<role>Provided PR #487 (support @JacksonAnnotationsInside annotations)</role>
</roles>
</contributor>
<contributor>
<url>https://github.com/hbzhou</url>
<roles>
<role>Provided PR #477 (drop JDK 11 support in favor of JDK 17)</role>
</roles>
</contributor>
</contributors>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<file.encoding>UTF-8</file.encoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<!-- maven plugins -->
<maven.plugin.version.checkstyle>3.6.0</maven.plugin.version.checkstyle>
<version.checkstyle>10.19.0</version.checkstyle>
Expand Down Expand Up @@ -286,7 +291,7 @@
<version>${maven.plugin.version.compiler}</version>
<configuration>
<showDeprecation>true</showDeprecation>
<release>17</release>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion jsonschema-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-parent</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-parent/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-generator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public TypeContext(AnnotationConfiguration annotationConfig) {
*/
public TypeContext(AnnotationConfiguration annotationConfig, SchemaGeneratorConfig generatorConfig) {
this(annotationConfig, generatorConfig.shouldDeriveFieldsFromArgumentFreeMethods());
if (annotationConfig instanceof AnnotationConfiguration.StdConfiguration configuration) {
if (annotationConfig instanceof AnnotationConfiguration.StdConfiguration stdConfiguration) {
generatorConfig.getAnnotationInclusionOverrides()
.forEach(configuration::setInclusion);
.forEach(stdConfiguration::setInclusion);
}
}

Expand Down Expand Up @@ -327,8 +327,8 @@ public <A extends Annotation> A getTypeParameterAnnotation(Class<A> annotationCl
* @since 4.30.0
*/
public Stream<Annotation> getTypeParameterAnnotations(AnnotatedType annotatedContainerType, Integer containerItemIndex) {
if (annotatedContainerType instanceof AnnotatedParameterizedType type) {
AnnotatedType[] typeArguments = type.getAnnotatedActualTypeArguments();
if (annotatedContainerType instanceof AnnotatedParameterizedType parameterizedType) {
AnnotatedType[] typeArguments = parameterizedType.getAnnotatedActualTypeArguments();
int itemIndex = containerItemIndex == null ? 0 : containerItemIndex;
if (typeArguments.length > itemIndex) {
return Stream.of(typeArguments[itemIndex].getAnnotations());
Expand Down Expand Up @@ -478,10 +478,10 @@ public String getMethodPropertyArgumentTypeDescription(ResolvedType type) {
public <R> R performActionOnMember(MemberScope<?, ?> member, Function<FieldScope, R> fieldAction,
Function<MethodScope, R> methodAction) {
R result;
if (member instanceof FieldScope scope) {
result = fieldAction.apply(scope);
} else if (member instanceof MethodScope scope) {
result = methodAction.apply(scope);
if (member instanceof FieldScope field) {
result = fieldAction.apply(field);
} else if (member instanceof MethodScope method) {
result = methodAction.apply(method);
} else {
throw new IllegalStateException("Unsupported member scope of type: " + member.getClass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,47 +379,47 @@ public AttributeCollector setEnum(ObjectNode node, Collection<?> enumValues, Sch

private void addRawPropertyValue(ObjectNode node, String propertyName, Object value) {
// need to specifically add simple/primitive values by type
if (value instanceof String string) {
if (value instanceof String stringValue) {
// explicit inclusion as string results in wrapping quote symbols
node.put(propertyName, string);
} else if (value instanceof BigDecimal decimal) {
node.put(propertyName, decimal);
} else if (value instanceof BigInteger integer) {
node.put(propertyName, integer);
} else if (value instanceof Boolean boolean1) {
node.put(propertyName, boolean1);
} else if (value instanceof Double double1) {
node.put(propertyName, double1);
} else if (value instanceof Float float1) {
node.put(propertyName, float1);
} else if (value instanceof Integer integer) {
node.put(propertyName, integer);
node.put(propertyName, stringValue);
} else if (value instanceof BigDecimal decimalValue) {
node.put(propertyName, decimalValue);
} else if (value instanceof BigInteger intValue) {
node.put(propertyName, intValue);
} else if (value instanceof Boolean boolValue) {
node.put(propertyName, boolValue);
} else if (value instanceof Double doubleValue) {
node.put(propertyName, doubleValue);
} else if (value instanceof Float floatValue) {
node.put(propertyName, floatValue);
} else if (value instanceof Integer intValue) {
node.put(propertyName, intValue);
} else {
// everything else is simply forwarded as-is to the JSON Schema, it's up to the configurator to ensure the value's correctness
node.putPOJO(propertyName, value);
}
}

private void addRawArrayItem(ArrayNode node, Object value) {
private void addRawArrayItem(ArrayNode node, Object item) {
// need to specifically add simple/primitive values by type
if (value instanceof String string) {
if (item instanceof String stringItem) {
// explicit inclusion as string results in wrapping quote symbols
node.add(string);
} else if (value instanceof BigDecimal decimal) {
node.add(decimal);
} else if (value instanceof BigInteger integer) {
node.add(integer);
} else if (value instanceof Boolean boolean1) {
node.add(boolean1);
} else if (value instanceof Double double1) {
node.add(double1);
} else if (value instanceof Float float1) {
node.add(float1);
} else if (value instanceof Integer integer) {
node.add(integer);
node.add(stringItem);
} else if (item instanceof BigDecimal decimalItem) {
node.add(decimalItem);
} else if (item instanceof BigInteger intItem) {
node.add(intItem);
} else if (item instanceof Boolean boolItem) {
node.add(boolItem);
} else if (item instanceof Double doubleItem) {
node.add(doubleItem);
} else if (item instanceof Float floatItem) {
node.add(floatItem);
} else if (item instanceof Integer intItem) {
node.add(intItem);
} else {
// everything else is simply forwarded as-is to the JSON Schema, it's up to the configurator to ensure the value's correctness
node.addPOJO(value);
node.addPOJO(item);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ private void generateArrayDefinition(GenericTypeDetails typeDetails, ObjectNode
}

private JsonNode populateItemMemberSchema(TypeScope targetScope) {
if (targetScope instanceof FieldScope scope && !scope.isFakeContainerItemScope()) {
return this.populateFieldSchema(scope.asFakeContainerItemScope());
if (targetScope instanceof FieldScope field && !field.isFakeContainerItemScope()) {
return this.populateFieldSchema(field.asFakeContainerItemScope());
}
if (targetScope instanceof MethodScope scope && !scope.isFakeContainerItemScope()) {
return this.populateMethodSchema(scope.asFakeContainerItemScope());
if (targetScope instanceof MethodScope method && !method.isFakeContainerItemScope()) {
return this.populateMethodSchema(method.asFakeContainerItemScope());
}
ObjectNode arrayItemDefinition = this.generatorConfig.createObjectNode();
this.traverseGenericType(targetScope.getContainerItemType(), arrayItemDefinition);
Expand Down
2 changes: 1 addition & 1 deletion jsonschema-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-parent</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-parent/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-maven-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsonschema-module-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-parent</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-parent/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-module-jackson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ protected int getPropertyIndex(MemberScope<?, ?> property) {
List<String> sortedProperties = this.propertyOrderPerDeclaringType
.computeIfAbsent(topMostHierarchyType.getErasedType(), this::getAnnotatedPropertyOrder);
String fieldName;
if (property instanceof MethodScope scope) {
fieldName = Optional.<MemberScope>ofNullable(scope.findGetterField())
if (property instanceof MethodScope method) {
fieldName = Optional.<MemberScope<?,?>>ofNullable(method.findGetterField())
// since 4.33.1: fall-back on method's property name if no getter can be found
.orElse(property)
.getSchemaPropertyName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ private Optional<ObjectNode> createUnwrappedMemberSchema(ResolvedMember<?> membe
*/
private void applyPrefixAndSuffixToPropertyNames(JsonNode definition, String prefix, String suffix, SchemaGenerationContext context) {
JsonNode properties = definition.get(context.getKeyword(SchemaKeyword.TAG_PROPERTIES));
if (properties instanceof ObjectNode node && !properties.isEmpty()) {
if (properties instanceof ObjectNode propertiesNode && !propertiesNode.isEmpty()) {
List<String> fieldNames = new ArrayList<>();
properties.fieldNames().forEachRemaining(fieldNames::add);
for (String fieldName : fieldNames) {
JsonNode propertySchema = node.remove(fieldName);
node.set(prefix + fieldName + suffix, propertySchema);
JsonNode propertySchema = propertiesNode.remove(fieldName);
propertiesNode.set(prefix + fieldName + suffix, propertySchema);
}
}
JsonNode allOf = definition.get(context.getKeyword(SchemaKeyword.TAG_ALLOF));
Expand Down
2 changes: 1 addition & 1 deletion jsonschema-module-jakarta-validation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-parent</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-parent/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-module-jakarta-validation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsonschema-module-javax-validation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-parent</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-parent/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-module-javax-validation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsonschema-module-swagger-1.5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-parent</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-parent/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-module-swagger-1.5</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jsonschema-module-swagger-2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-parent</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../jsonschema-generator-parent/pom.xml</relativePath>
</parent>
<artifactId>jsonschema-module-swagger-2</artifactId>
Expand Down
5 changes: 1 addition & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@

<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator-reactor</artifactId>
<version>4.38.0-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Java JSON Schema Generator (Reactor)</name>
<description>Java JSON Schema Generator + Modules – creating a JSON Schema from your Java classes</description>
<url>https://github.com/victools/jsonschema-generator</url>
<properties>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<!-- For list of contributors, refer to jsonschema-generator-parent/pom.xml -->

Expand Down

0 comments on commit 214b262

Please sign in to comment.