Tufin / oasdiff

OpenAPI Diff and Breaking Changes
https://www.oasdiff.com
Apache License 2.0
689 stars 59 forks source link

Add support for AWS API Gateway extensions to OpenAPI #513

Closed vainkop closed 5 months ago

vainkop commented 5 months ago

Is your feature request related to a problem? Please describe. When doing a diff & there are changes in any of x-amazon-apigateway- sections they're not shown AWS API Gateway extensions for OpenAPI seem to be not supported AWS doc

Describe the solution you'd like A diff should be shown for x-amazon-apigateway- sections.

Additional context

part of api-oas30-apigateway.yaml

  /example/callback:
    post:
      responses:
        '200':
          description: 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Empty'
      x-amazon-apigateway-integration:
        type: http_proxy
        connectionId: ${vpc_link_id}
        httpMethod: POST
        uri: http://api.example.com/v1/example/callback
        responses:
          default:
            statusCode: '200'
        passthroughBehavior: when_no_match
        connectionType: VPC_LINK

part of processed-api-oas30-apigateway.yaml

  /example/callback:
    post:
      responses:
        '200':
          description: 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Empty'
      x-amazon-apigateway-integration:
        type: http_proxy
        connectionId: ${vpc_link_id}
        httpMethod: POST
        uri: http://api.example.com/v1/example/calllllllllback
        responses:
          default:
            statusCode: '200'
        passthroughBehavior: when_no_match
        connectionType: VPC_LINK

callback > calllllllllback

oasdiff diff api-oas30-apigateway.yaml processed-api-oas30-apigateway.yaml -f text
No changes
reuvenharrison commented 5 months ago

OpenAPI spec extensions are excluded from the diff.

Including this extension in the diff would require an enhancement.

vainkop commented 5 months ago

OpenAPI spec extensions are excluded from the diff.

Including this extension in the diff would require an enhancement.

That's exactly what I've tried to request :) Currently I have to use colordiff on top of oasdiff which kind of makes oasdiff not that useful as it could be & AWS API Gateways are pretty popular.

Unfortunately I don't have enough time & Golang expertise to implement that enhancement myself :(

reuvenharrison commented 5 months ago

We could output this with a relatively small effort:

endpoints:
    modified:
        ?   method: POST
            path: /example/callback
        :   extensions:
                modified:
                    x-amazon-apigateway-integration:
                        from:
                            connectionId: ${vpc_link_id}
                            connectionType: VPC_LINK
                            httpMethod: POST
                            passthroughBehavior: when_no_match
                            responses:
                                default:
                                    statusCode: "200"
                            type: http_proxy
                            uri: http://api.example.com/v1/example/callback
                        to:
                            connectionId: ${vpc_link_id}
                            connectionType: VPC_LINK
                            httpMethod: POST
                            passthroughBehavior: when_no_match
                            responses:
                                default:
                                    statusCode: "200"
                            type: http_proxy
                            uri: http://api.example.com/v1/example/calllllllllback

Do you think it is good enough?

vainkop commented 5 months ago

We could output this with a relatively small effort: Do you think it is good enough?

That's definitely better than "No changes"! :)

Of course I'd prefer to see smth like that:

 endpoints:
     modified:
         ?   method: POST
             path: /example/callback
         :   extensions:
                 modified:
                     x-amazon-apigateway-integration:
         -                 uri: http://api.example.com/v1/example/callback
         +                 uri: http://api.example.com/v1/example/calllllllllback
vainkop commented 5 months ago

@reuvenharrison thank you! Any chance of adding that into a release any time soon?

reuvenharrison commented 5 months ago

Sure. I'm planning to do it tomorrow.