thim81 / openapi-format

Format an OpenAPI document by ordering, formatting and filtering fields.
MIT License
77 stars 14 forks source link

"properties" casing changes not reflect in the "required" fields #77

Closed murugavelmca closed 8 months ago

murugavelmca commented 1 year ago

In below example, properties of schemas are updated to snake_case as expected. But corresponding "required" fields left with older state (ex. "emailAddress" left as is after casing updates).

Formatting casing example:

properties: snake_case

Example before:

openapi: 3.0.3
components:
    schemas:
        UserModel:
            type: object
            properties:
                id:
                    type: integer
                    example: 10
                emailAddress:
                    type: string
                    example: john@doe.com
                firstName:
                    type: string
                    example: John
            required:
                - id
                - emailAddress

Example after:

openapi: 3.0.3
components:
    schemas:
        UserModel:
            type: object
            properties:
                id:
                    type: integer
                    example: 10
                email_address:
                    type: string
                    example: john@doe.com
                first_name:
                    type: string
                    example: John
            required:
                - id
                - emailAddress
thim81 commented 1 year ago

hi @murugavelmca

Good catch, that looks like a bug. I'll try to find some time to fix it in the coming weeks.

thim81 commented 8 months ago

hi @murugavelmca

I have added the logic to handle the casing of the required fields. The changes will be part of the next release.

thim81 commented 8 months ago

hi @murugavelmca

There is a new version of OpenAPI format, where the required fields will be changed according to the casing defined.

thim81 commented 8 months ago

Closing this issue, in case you have more feedback, let me know.