issue with changing a property from required to non-required in the response (and request) schema

Issue #38 new
Rico M created an issue

I am trying to make a change from required to non-required in a response schema. I removed from dataCurrentContract

So this is how I am passing values to diffSpecs:

dataReferenceContract - existing spec

dataCurrentContract - new spec

    result = await openapiDiff.diffSpecs({
      sourceSpec: {
        content: dataReferenceContract,
        location: referenceContract,
        format: 'openapi3'
      },
      destinationSpec: {
        content: dataCurrentContract,
        location: currentContract,              
        format: 'openapi3'
      }
    });

but the result is as if I am adding something

{
breakingDifferences: [
{
type: 'breaking',
action: 'add',
code: 'response.body.scope.add',
destinationSpecEntityDetails: [Array],
entity: 'response.body.scope',
source: 'json-schema-diff',
sourceSpecEntityDetails: [Array],
details: [Object]
},
{
type: 'breaking',
action: 'add',
code: 'response.body.scope.add',
destinationSpecEntityDetails: [Array],
entity: 'response.body.scope',
source: 'json-schema-diff',
sourceSpecEntityDetails: [Array],
details: [Object]
},
{
type: 'breaking',
action: 'add',
code: 'response.body.scope.add',
destinationSpecEntityDetails: [Array],
entity: 'response.body.scope',
source: 'json-schema-diff',
sourceSpecEntityDetails: [Array],
details: [Object]
}
],
breakingDifferencesFound: true,
nonBreakingDifferences: [],
unclassifiedDifferences: []
}

Comments (7)

  1. Rico M reporter

    I also did it in a request schema (making a property as non-required from being required) but the result I am getting is as if a property is being added

    {
      breakingDifferences: [
        {
          type: 'breaking',
          action: 'add',
          code: 'response.body.scope.add',
          destinationSpecEntityDetails: [Array],
          entity: 'response.body.scope',
          source: 'json-schema-diff',
          sourceSpecEntityDetails: [Array],
          details: [Object]
        },
        {
          type: 'breaking',
          action: 'add',
          code: 'response.body.scope.add',
          destinationSpecEntityDetails: [Array],
          entity: 'response.body.scope',
          source: 'json-schema-diff',
          sourceSpecEntityDetails: [Array],
          details: [Object]
        }
      ],
      breakingDifferencesFound: true,
      nonBreakingDifferences: [
        {
          type: 'non-breaking',
          action: 'add',
          code: 'request.body.scope.add',
          destinationSpecEntityDetails: [Array],
          entity: 'request.body.scope',
          source: 'json-schema-diff',
          sourceSpecEntityDetails: [Array],
          details: [Object]
        },
        {
          type: 'non-breaking',
          action: 'add',
          code: 'request.body.scope.add',
          destinationSpecEntityDetails: [Array],
          entity: 'request.body.scope',
          source: 'json-schema-diff',
          sourceSpecEntityDetails: [Array],
          details: [Object]
        }
      ],
      unclassifiedDifferences: []
    }
    

  2. Log in to comment