File: dialects.py

package info (click to toggle)
python-mashumaro 3.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,408 kB
  • sloc: python: 19,981; sh: 16; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from dataclasses import dataclass


@dataclass(frozen=True)
class JSONSchemaDialect:
    uri: str
    definitions_root_pointer: str
    all_refs: bool


@dataclass(frozen=True)
class JSONSchemaDraft202012Dialect(JSONSchemaDialect):
    uri: str = "https://json-schema.org/draft/2020-12/schema"
    definitions_root_pointer: str = "#/$defs"
    all_refs: bool = False


@dataclass(frozen=True)
class OpenAPISchema31Dialect(JSONSchemaDialect):
    uri: str = "https://spec.openapis.org/oas/3.1/dialect/base"
    definitions_root_pointer: str = "#/components/schemas"
    all_refs: bool = True


DRAFT_2020_12 = JSONSchemaDraft202012Dialect()
OPEN_API_3_1 = OpenAPISchema31Dialect()


__all__ = ["JSONSchemaDialect", "DRAFT_2020_12", "OPEN_API_3_1"]