АП
Size: a a a
АП
T
T
import yaml
import json
schema = json.load(open('schema.json'))
schema['$schema']
>>> 'http://json-schema.org/draft-04/schema#'
swagger = yaml.safe_load(open('requirements/swagger.yml'))
swagger['openapi']
>>> '3.0.1'
validate(instance=swagger, schema=schema)
from jsonschema import validate
validate(instance=swagger, schema=schema)
return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object
ajv validate --all-errors -s schema.json -d requirements/swagger.yml
requirements/swagger.yml valid
T
T
GB
АП
openapi: "3.0.1"
x-explorer-enabled: true
info:
title: "Foo"
version: "1.0.0"
servers:
- url: "https://example.com"
paths:
/foo:
get:
responses:
200:
description: "200 response"
content:
application/json:
schema:
$ref: "#/components/schemas/MySchemaRef"
components:
schemas:
MySchemaRef:
title: "result"
type: object
Любая схема с рефом.T
АП
app.config
же.T
openapi: "3.0.1"
x-explorer-enabled: true
info:
title: "Foo"
version: "1.0.0"
servers:
- url: "https://example.com"
paths:
/foo:
get:
responses:
200:
description: "200 response"
content:
application/json:
schema:
$ref: "#/components/schemas/MySchemaRef"
components:
schemas:
MySchemaRef:
title: "result"
type: object
Любая схема с рефом.T
АП
V
GB
app.config
же.АП
GB
АП
GB
T
openapi: "3.0.1"
x-explorer-enabled: true
info:
title: "Foo"
version: "1.0.0"
servers:
- url: "https://example.com"
paths:
/foo:
get:
responses:
200:
description: "200 response"
content:
application/json:
schema:
$ref: "#/components/schemas/MySchemaRef"
components:
schemas:
MySchemaRef:
title: "result"
type: object
Любая схема с рефом.