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)
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)
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)
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)
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)
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)
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}"
class NewColumnSchema(typesystem.Schema): name = typesystem.String(max_length=100) datatype = typesystem.Choice(choices=["string", "integer"])
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)),
) 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(
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")])
class Contact(typesystem.Schema): a = typesystem.Boolean() b = typesystem.String(max_length=10) c = typesystem.Text() d = typesystem.Choice(choices=["abc", "def", "ghi"])
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"], )