Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON schema compatibility rule bug: Remove an optional field should be backward compatible not full compatible #1444

Open
shionefaye opened this issue Apr 19, 2021 · 3 comments
Assignees

Comments

@shionefaye
Copy link

It is tested with the code in at this commit.

"original": {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "postal_code": {
      "type": "number"
    },
    "street": {
      "type": "string"
    }
  }
},
"updated": {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "street": {
      "type": "string"
    }
  }
}
@blacktooth
Copy link
Contributor

Hello shionefaye,

Can you please share the code / test results that you tested this with?

jsenko added a commit to jsenko/apicurio-registry that referenced this issue Apr 20, 2021
@jsenko
Copy link
Member

jsenko commented Apr 20, 2021

Hello @shionefaye ,
I've run your test case and it works as expected. Please share more info (as @blacktooth mentioned) or I'll have to close this issue. Thanks!
See https://github.com/jsenko/apicurio-registry/tree/tmp1

@jsenko jsenko self-assigned this Apr 20, 2021
@shionefaye
Copy link
Author

Hi blacktooth and jsenko,

Thanks for the timely response. I tested the with the latest change in the master branch.

Now I run the test with with tmp1 branch. The issues I reported in this and #1443 is gone. But a new issue emerges

The following change is backward compatible only.

"original": {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "postal_code": {
      "type": "number"
    }
  },
  "additionalProperties": {
    "type": "number"
  }
},
"updated": {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "postal_code": {
      "type": "number"
    },
    "street": {
      "type": "number"
    }
  },
  "additionalProperties": {
    "type": "number"
  }
}

Backward Difference: [Difference(diffType=OBJECT_TYPE_PROPERTY_SCHEMAS_MEMBER_ADDED, pathOriginal=, pathUpdated=/properties, subSchemaOriginal=null, subSchemaUpdated=street)]
Foward Difference: []

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

No branches or pull requests

3 participants