Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created May 2, 2025 10:40
Show Gist options
  • Save bogdan/f5fbf0f5940d5540b60ca086beef3fea to your computer and use it in GitHub Desktop.
Save bogdan/f5fbf0f5940d5540b60ca086beef3fea to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Sample API with x-nullable nested schema"
},
"host": "api.example.com",
"basePath": "/v1",
"schemes": ["https"],
"paths": {
"/items/{id}": {
"get": {
"summary": "Get a specific item",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "The requested item",
"schema": {
"$ref": "#/definitions/Item"
}
}
}
}
}
},
"definitions": {
"Item": {
"type": "object",
"required": ["name", "active_listing", "description"],
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string",
"x-nullable": true
},
"active_listing": {
"x-nullable": true,
"$ref": "#/definitions/Listing"
}
}
},
"Listing": {
"type": "object",
"required": ["price", "currency", "seller"],
"properties": {
"price": {
"type": "number",
"format": "float"
},
"currency": {
"type": "string"
},
"seller": {
"type": "string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment