Esempio n. 1
0
class InitiateAuthResponse(typesystem.Schema):
    ChallengeName = typesystem.Choice(choices=list(ChallengeNameType),
                                      allow_null=True)
    Session = typesystem.String(max_length=2048, allow_null=True)
    ChallengeParameters = typesystem.Object(allow_null=True)
    AuthenticationResult = typesystem.Reference(AuthenticationResultType,
                                                allow_null=True)
Esempio n. 2
0
class InitiateAuthRequest(typesystem.Schema):
    AuthFlow = typesystem.Choice(choices=list(AuthFlowType))
    AuthParameters = typesystem.Object()
    ClientMetadata = typesystem.Object(allow_null=True)
    ClientId = typesystem.String()
    AnalyticsMetadata = typesystem.Reference(AnalyticsMetadataType,
                                             allow_null=True)
    UserContextData = typesystem.Reference(UserContextDataType,
                                           allow_null=True)
Esempio n. 3
0
class Booking(typesystem.Schema):
    start_date = typesystem.Date()
    end_date = typesystem.Date()
    room = typesystem.Choice(choices=[
        ("double", "Double room"),
        ("twin", "Twin room"),
        ("single", "Single room"),
    ])
    include_breakfast = typesystem.Boolean(title="Include breakfast",
                                           default=False)
Esempio n. 4
0
class Settings(BaseSchema):
    enforce_https = typesystem.Boolean(default=False)
    mode = typesystem.Choice(
        choices=(
            ("proxy", "Proxy"),
            ("redirect", "Redirect"),
        ),
        default="proxy",
    )
    certificate_path = typesystem.String(allow_null=True)
    key_path = typesystem.String(allow_null=True)
Esempio n. 5
0
class Settings(BaseSchema):
    enforce_https = typesystem.Boolean(default=False)
    mode = typesystem.Choice(
        choices=(
            ("proxy", "Proxy"),
            ("redirect", "Redirect"),
        ),
        default="proxy",
    )
    headers = typesystem.Object(default={}, properties=typesystem.String(max_length=100))
    ttl = typesystem.Integer(allow_null=True)
    certificate_path = typesystem.String(allow_null=True)
    key_path = typesystem.String(allow_null=True)
Esempio n. 6
0
class Config(typesystem.Schema):
    port = typesystem.Integer()
    logLevel = typesystem.Choice(
        title="LogLevel",
        choices=[(x, x)
                 for x in ["debug", "info", "warn", "error", "critical"]],
    )
    # not supported
    # secondary = typesystem.Reference(
    #     to="Config", allow_null=True, definitions=definitions
    # )
    xxxAPI = typesystem.Reference(to=XXXAPI,
                                  allow_null=True,
                                  definitions=definitions)
Esempio n. 7
0
class BookingSchema(typesystem.Schema):
    start_date = typesystem.Date(title="Start date")
    end_date = typesystem.Date(title="End date")
    room = typesystem.Choice(
        title="Room type",
        choices=[
            ("double", "Double room"),
            ("twin", "Twin room"),
            ("single", "Single room"),
        ],
    )
    include_breakfast = typesystem.Boolean(title="Include breakfast",
                                           default=False)

    def __str__(self):
        breakfast = ("(with breakfast)"
                     if self.include_breakfast else "(without breakfast)")
        return f"Booking for {self.room} from {self.start_date} to {self.end_date}"
Esempio n. 8
0
class NewColumnSchema(typesystem.Schema):
    name = typesystem.String(max_length=100)
    datatype = typesystem.Choice(choices=["string", "integer"])
Esempio n. 9
0
SWAGGER = typesystem.Object(
    title="Swagger",
    properties={
        "swagger":
        typesystem.String(),
        "info":
        typesystem.Reference("Info", definitions=definitions),
        "paths":
        typesystem.Reference("Paths", definitions=definitions),
        "host":
        typesystem.String(),
        "basePath":
        typesystem.String(pattern="^/"),
        "schemes":
        typesystem.Array(items=typesystem.Choice(
            choices=["http", "https", "ws", "wss"])),
        "consumes":
        typesystem.Array(items=typesystem.String()),
        "produces":
        typesystem.Array(items=typesystem.String()),
        "definitions":
        typesystem.Object(additional_properties=typesystem.Any()),
        "parameters":
        typesystem.Object(additional_properties=typesystem.Reference(
            "Parameters", definitions=definitions)),
        "responses":
        typesystem.Object(additional_properties=typesystem.Reference(
            "Responses", definitions=definitions)),
        "securityDefinitions":
        typesystem.Object(additional_properties=typesystem.Reference(
            "SecurityScheme", definitions=definitions)),
Esempio n. 10
0
)

definitions["ExternalDocumentation"] = typesystem.Object(
    properties={
        "description": typesystem.Text(allow_blank=True),
        "url": typesystem.String(format="url"),
    },
    pattern_properties={"^x-": typesystem.Any()},
    additional_properties=False,
    required=["url"],
)

definitions["Parameter"] = typesystem.Object(
    properties={
        "name": typesystem.String(),
        "in": typesystem.Choice(choices=["query", "header", "path", "cookie"]),
        "description": typesystem.Text(allow_blank=True),
        "required": typesystem.Boolean(),
        "deprecated": typesystem.Boolean(),
        "allowEmptyValue": typesystem.Boolean(),
        "style": typesystem.Choice(choices=["matrix", "label", "form", "simple", "spaceDelimited", "pipeDelimited", "deepObject"]),
        "schema": JSON_SCHEMA | SCHEMA_REF,
        "example": typesystem.Any(),
        # TODO: Other fields
    },
    pattern_properties={"^x-": typesystem.Any()},
    additional_properties=False,
    required=["name", "in"],
)

definitions["RequestBody"] = typesystem.Object(
Esempio n. 11
0
class Contact(typesystem.Schema):
    a = typesystem.Boolean()
    b = typesystem.String(max_length=10)
    c = typesystem.Text()
    d = typesystem.Choice(choices=[("abc", "Abc"), ("def",
                                                    "Def"), ("ghi", "Ghi")])
Esempio n. 12
0
class Contact(typesystem.Schema):
    a = typesystem.Boolean()
    b = typesystem.String(max_length=10)
    c = typesystem.Text()
    d = typesystem.Choice(choices=["abc", "def", "ghi"])
Esempio n. 13
0
import typesystem

APISTAR_CONFIG = typesystem.Object(
    properties={
        "schema":
        typesystem.Object(
            properties={
                "path": typesystem.String(),
                "format": typesystem.Choice(choices=["openapi", "swagger"]),
                "base_format": typesystem.Choice(choices=["json", "yaml"]),
            },
            additional_properties=False,
            required=["path", "format"],
        ),
        "docs":
        typesystem.Object(
            properties={
                "output_dir":
                typesystem.String(),
                "theme":
                typesystem.Choice(choices=["apistar", "redoc", "swaggerui"]),
            },
            additional_properties=False,
        ),
    },
    additional_properties=False,
    required=["schema"],
)