OpenAPITools / OpenAPITools/openapi-diff

Schema description update should be considered as a metadata change

Open
#694 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Breaking/Non-Breaking classification duplicate
Dominant language
Java
Stars
1.1k
Forks
190
PR merge metrics
No merged PRs in 30d

Description

Hello,

When diffing this spec:

openapi: 3.0.3
info:
  title: Test
paths:
  /foo:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: string
              description: desc v1

with this one:

openapi: 3.0.3
info:
  title: Test
paths:
  /foo:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: string
              description: desc v2

I get the following output:

==========================================================================
==                            API CHANGE LOG                            ==
==========================================================================
                                   Test                                   
--------------------------------------------------------------------------
--                            What's Changed                            --
--------------------------------------------------------------------------
- POST   /foo
  Request:
        - Changed application/json
          Schema: Backward compatible
--------------------------------------------------------------------------
--                                Result                                --
--------------------------------------------------------------------------
                   API changes are backward compatible                    
--------------------------------------------------------------------------

Since only the description field changed, I would expect a "metadata" change instead of a "compatible" one.

Changes to the description are correctly marked as metadata ones internally (see here and here) but I suspect the final value that is picked up to be the default one returned here. I don't have the time or means to debug it further however.

Tested version: 2.1.0-beta.11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied OpenAPI diff, then inspect core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java around the referenced line 160, alongside ChangedMetadata.java and the metadata handling in ChangedSchema.java. Done means a schema description-only change is reported as a metadata change rather than merely backward compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.