Skip to content

Conversation

Yauhenikapl
Copy link
Contributor

OpenAPI generation: fix properties alongside $refs are ignored and roll back items in items for array type fix

Description

Please include a summary of the changes and the related issue. List any dependencies that are required for this change.

Fixes #761

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Additional notes

@Yauhenikapl Yauhenikapl requested a review from atextor June 3, 2025 08:27
arrayNode.put( "type", "array" );
arrayNode.set( "items", FACTORY.objectNode().put( "$ref", "#/components/schemas/" + aspect.getName() ) );

propertiesNode.set( propertyName, arrayNode );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logic fixing this structure:

"PagingSchema" : {
        "type" : "object",
        "properties" : {
          ...
          "items" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/AspectWithErrorCollection"
            }
          }
        }
      },

to this:

"PagingSchema" : {
        "type" : "object",
        "properties" : {
          ...
          "aspectItems" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/AspectWithErrorCollection"
            }
          }
        }
      },

It means, that attribute "items" will be taken from property name and not by default "items".

@atextor

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.

[BUG] OpenAPI generation: properties alongside $refs are ignored
1 participant