Skip to content

update swagger tooling for code generator - #25

Merged
SirCotare merged 6 commits into
mainfrom
update-swagger
Aug 8, 2025
Merged

update swagger tooling for code generator#25
SirCotare merged 6 commits into
mainfrom
update-swagger

Conversation

@SirCotare

Copy link
Copy Markdown
Member

No description provided.

@SirCotare SirCotare self-assigned this Aug 6, 2025
@SirCotare
SirCotare requested a review from ThoSap August 8, 2025 13:27
@ThoSap
ThoSap requested a review from Copilot August 8, 2025 14:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates Swagger tooling to support code generation, introducing new customizers and utilities while reorganizing the package structure and updating dependencies.

  • Refactored support test classes from support to _support package
  • Added new Swagger customizers for code generation with metadata utilities
  • Updated Spring Boot and related dependencies to newer versions

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Test files (QueryTransformerTest.java, etc.) Updated import statements to use new _support package structure
Support classes (_support/*.java) Moved from support to _support package with updated internal imports
Swagger customizers Added new customizers for nested structures, custom types, and code generation support
SwaggerMetaUtil.java Added setIsCustomType method for metadata handling
SwaggerMeta.java Added isCustomType field to support code generation metadata
TestApp.java Removed @RegisterCustomTypesWithSwagger annotation
pom.xml Updated Spring Boot, SpringDoc, and Testcontainers versions

if (parameter.getSchema() instanceof ObjectSchema
&& parameter.getSchema().get$ref() != null
) {
schemaRef = parameter.getSchema().getItems().get$ref();

Copilot AI Aug 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should use parameter.getSchema().get$ref() instead of parameter.getSchema().getItems().get$ref() when the schema is an ObjectSchema, as ObjectSchema doesn't have items.

Suggested change
schemaRef = parameter.getSchema().getItems().get$ref();
schemaRef = parameter.getSchema().get$ref();

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SirCotare check if this is correct, or leave it as is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm lacking a testcase. But I think it is fine.

if (parameter.getSchema() instanceof ObjectSchema
&& parameter.getSchema().get$ref() != null
) {
schemaRef = parameter.getSchema().getItems().get$ref();

Copilot AI Aug 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should use parameter.getSchema().get$ref() instead of parameter.getSchema().getItems().get$ref() when the schema is an ObjectSchema, as ObjectSchema doesn't have items.

Suggested change
schemaRef = parameter.getSchema().getItems().get$ref();
schemaRef = parameter.getSchema().get$ref();

Copilot uses AI. Check for mistakes.
@Slf4j
public class CustomTypeParameterCustomizer implements ParameterCustomizer {

public Optional<Class<?>> getClassFromSchemaReference(String schemaRef) {

Copilot AI Aug 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is duplicated across multiple customizer classes. Consider extracting it to a shared utility class to reduce code duplication.

Copilot uses AI. Check for mistakes.
return parameter;
}

public Optional<Class<?>> getClassFromSchemaReference(String schemaRef) {

Copilot AI Aug 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is duplicated across multiple customizer classes. Consider extracting it to a shared utility class to reduce code duplication.

Copilot uses AI. Check for mistakes.
openApi.getComponents().getSchemas().forEach(this::updateSchema);
}

public Optional<Class<?>> getClassFromSchemaReference(String schemaRef) {

Copilot AI Aug 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is duplicated across multiple customizer classes. Consider extracting it to a shared utility class to reduce code duplication.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find!

@ThoSap ThoSap left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

openApi.getComponents().getSchemas().forEach(this::updateSchema);
}

public Optional<Class<?>> getClassFromSchemaReference(String schemaRef) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find!

@SirCotare
SirCotare merged commit 2e7f6f5 into main Aug 8, 2025
1 check passed
@SirCotare
SirCotare deleted the update-swagger branch August 8, 2025 15:29
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

Successfully merging this pull request may close these issues.

3 participants