A schema should accept the real examples and refuse what the rules forbid. What 2020-12 changes, what OpenAPI 3.1 inherits, and a test built to fail.
A schema is only useful if it decides correctly in both directions: it has to accept every legitimate document, including ones nobody has shown you yet, and refuse the ones the rules forbid. Copying the shape of one example gets the first half wrong, because an example proves what exists and not what is allowed. This guide goes through the keywords that decide those two outcomes in JSON Schema 2020-12, then through what changes when the schema is placed inside an OpenAPI 3.1 document (the migration notes), and finishes with a test built to fail.
Read the full report on AISkills402: https://aiskills402.com/blog/json-schema-2020-12-openapi-3-1?utm_source=devto&utm_medium=social
Top comments (0)