fork of hey-api/openapi-ts because I need some additional things
at main 163 lines 3.9 kB view raw
1{ 2 "openapi": "3.1.0", 3 "info": { 4 "title": "OpenAPI 3.1.0 pattern properties example", 5 "version": "1" 6 }, 7 "paths": { 8 "/pattern-test": { 9 "post": { 10 "summary": "Test pattern properties", 11 "requestBody": { 12 "required": true, 13 "content": { 14 "application/json": { 15 "schema": { 16 "$ref": "#/components/schemas/PatternPropertiesTest" 17 } 18 } 19 } 20 }, 21 "responses": { 22 "200": { 23 "description": "Success", 24 "content": { 25 "application/json": { 26 "schema": { 27 "$ref": "#/components/schemas/PatternPropertiesResponse" 28 } 29 } 30 } 31 } 32 } 33 } 34 } 35 }, 36 "components": { 37 "schemas": { 38 "PatternPropertiesTest": { 39 "type": "object", 40 "properties": { 41 "id": { 42 "type": "string" 43 }, 44 "metadata": { 45 "$ref": "#/components/schemas/MetadataObject" 46 } 47 }, 48 "additionalProperties": false 49 }, 50 "MetadataObject": { 51 "type": "object", 52 "properties": { 53 "name": { 54 "type": "string" 55 }, 56 "description": { 57 "type": "string" 58 } 59 }, 60 "patternProperties": { 61 "^meta_": { 62 "type": "string", 63 "description": "Any property starting with 'meta_' must be a string" 64 }, 65 "^config_": { 66 "type": "object", 67 "properties": { 68 "value": { 69 "type": "string" 70 }, 71 "enabled": { 72 "type": "boolean" 73 } 74 }, 75 "additionalProperties": false 76 }, 77 "^tag_[a-zA-Z0-9_]+$": { 78 "type": "string", 79 "description": "Tag properties must match pattern and be strings" 80 }, 81 "^[0-9]+_item$": { 82 "type": "array", 83 "items": { 84 "type": "string" 85 }, 86 "description": "Numbered item properties must be arrays of strings" 87 } 88 }, 89 "additionalProperties": false 90 }, 91 "NestedPatternObject": { 92 "type": "object", 93 "properties": { 94 "base": { 95 "type": "string" 96 } 97 }, 98 "patternProperties": { 99 "^nested_": { 100 "type": "object", 101 "patternProperties": { 102 "^sub_": { 103 "type": "string" 104 } 105 }, 106 "additionalProperties": false 107 } 108 }, 109 "additionalProperties": false 110 }, 111 "UnionPatternObject": { 112 "type": "object", 113 "properties": { 114 "type": { 115 "type": "string", 116 "enum": ["user", "admin", "guest"] 117 } 118 }, 119 "patternProperties": { 120 "^user_": { 121 "oneOf": [ 122 { 123 "type": "string" 124 }, 125 { 126 "type": "number" 127 } 128 ] 129 }, 130 "^admin_": { 131 "allOf": [ 132 { 133 "type": "object" 134 }, 135 { 136 "properties": { 137 "level": { 138 "type": "number", 139 "minimum": 1, 140 "maximum": 10 141 } 142 } 143 } 144 ] 145 } 146 }, 147 "additionalProperties": false 148 }, 149 "PatternPropertiesResponse": { 150 "type": "object", 151 "properties": { 152 "success": { 153 "type": "boolean" 154 }, 155 "data": { 156 "$ref": "#/components/schemas/MetadataObject" 157 } 158 }, 159 "additionalProperties": false 160 } 161 } 162 } 163}