thema icon indicating copy to clipboard operation
thema copied to clipboard

Move schemas to the root of the json

Open undef1nd opened this issue 2 years ago • 3 comments

I guess it's better to illustrate what this PR does with an example:

before this PR schema is defined under $.components.schemas

{
    "openapi": "3.0.0",
    "info": {
        "title": "team",
        "version": "0.0"
    },
    "paths": {},
    "components": {
        "schemas": {
            "team": {
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "description": "Name of the team.",
                        "type": "string"
                    }
                },
                "$schema": "http://json-schema.org/draft-04/schema#"
            }
        }
    }
}

This change moves the schema definition to the root of the JSON:

[
  {
    "team": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "description": "Name of the team.",
          "type": "string"
        }
      },
      "$schema": "http://json-schema.org/draft-04/schema#"
    }
  }
]

undef1nd avatar Jan 13 '23 16:01 undef1nd