Esempio n. 1
0
class ItemPutRequest:
    id = doc.Integer()  # Ignored in favor of URL
    brand = doc.String()
    name = doc.String(required=True)
    item_size = doc.Float(required=True)
    unit = doc.String(required=True)
    count = doc.Float(required=True)
    serving = doc.Float()
    category = doc.String()
    subcategory = doc.String()
    expiration_date = doc.Date()
    purchase_date = doc.Date()
    created_at = doc.DateTime()
    deleted_at = doc.DateTime()
    inventory_id = doc.Integer(required=True)
Esempio n. 2
0
class ItemPostRequest:
    brand = doc.String()
    name = doc.String(required=True)
    item_size = doc.Float(required=True)
    unit = doc.String(required=True)
    count = doc.Float(required=True)
    category = doc.String()
    subcategory = doc.String()
    expiration_date = doc.Date()
class ExposureDetectionSummary:
    """
    Documentation class for the exposure_detection_summaries' entries.
    """

    date = doc.Date(required=True)
    matched_key_count = doc.Integer(required=True)
    days_since_last_exposure = doc.Integer(required=True)
    attenuation_durations = doc.List(int, required=True)
    maximum_risk_score = doc.Integer(required=True)
    exposure_info = doc.List(ExposureInfo, required=True)
class ExposureInfo:
    """
    Documentation class for the exposure info's entries.
    """

    date = doc.Date(required=True)
    duration = doc.Integer(required=True)
    attenuation_value = doc.Integer(required=True)
    attenuation_durations = doc.List(int, required=True)
    transmission_risk_level = doc.Integer(required=True)
    total_risk_score = doc.Integer(required=True)
Esempio n. 5
0
class Video:
    id = doc.Integer()
    description_path = doc.String()
    ext = doc.String()
    poster_path = doc.String()
    source_id = doc.String()
    title = doc.String()
    upload_date = doc.Date()
    video_path = doc.String()
    name = doc.String()
    caption_path = doc.String()
    idempotency = doc.String()
    info_json_path = doc.String()
    channel_id = doc.Integer()
Esempio n. 6
0
class ExampleModel:
    """
    Example domain object documentation that is used in swagger definition
    """
    field_a = doc.Float(description="field a description")
    field_b = doc.Integer(description="field b description")
    field_c = doc.Date(description="field c description")
    field_d = doc.Boolean(description="field d description")
    field_e = doc.String(description="field e description")

    def _validation_schema(self):
        return {
            'field_a': {'type': 'float', 'required': True, 'empty': False},
            'field_b': {'type': 'int', 'required': True, 'empty': False},
            'field_c': {'type': 'str', 'required': True, 'empty': False},
            'field_d': {'type': 'bool', 'required': True, 'empty': False},
            'field_e': {'type': 'str', 'required': True, 'empty': False},
        }
Esempio n. 7
0
def test_date_field(app):

    field = doc.Date()
    assert field.serialize() == {"type": "string", "format": "date"}

    @app.get("/")
    @doc.consumes(field, location="body", required=True)
    def test(request):
        return text("test")

    _, response = app.test_client.get("/swagger/swagger.json")
    assert response.status == 200
    assert response.content_type == "application/json"

    swagger_json = response.json
    path = swagger_json["paths"]["/"]["get"]
    assert path["parameters"][0] == {
        "required": True,
        "in": "body",
        "name": None,
        "type": "string",
        "format": "date",
    }
Esempio n. 8
0
        (doc.Field(), {}),
        (int, {"type": "integer", "format": "int64"}),
        (doc.Integer, {"type": "integer", "format": "int64"}),
        (doc.Integer(), {"type": "integer", "format": "int64"}),
        (float, {"type": "number", "format": "double"}),
        (doc.Float, {"type": "number", "format": "double"}),
        (doc.Float(), {"type": "number", "format": "double"}),
        (str, {"type": "string"}),
        (doc.String, {"type": "string"}),
        (doc.String(), {"type": "string"}),
        (bool, {"type": "boolean"}),
        (doc.Boolean, {"type": "boolean"}),
        (doc.Boolean(), {"type": "boolean"}),
        (date, {"type": "string", "format": "date"}),
        (doc.Date, {"type": "string", "format": "date"}),
        (doc.Date(), {"type": "string", "format": "date"}),
        (datetime, {"type": "string", "format": "date-time"}),
        (doc.DateTime, {"type": "string", "format": "date-time"}),
        (doc.DateTime(), {"type": "string", "format": "date-time"}),
        (TestSchema, {"$ref": "#/definitions/TestSchema"}),
        (dict, {"type": "object", "properties": {}}),
        ({"foo": "bar"}, {"type": "object", "properties": {"foo": {}}}),
        (list, {"type": "array", "items": []}),
        (["foo", "bar"], {"type": "array", "items": {"description": ["foo", "bar"]}}),
    ],
)
def test_serialize_schema(schema, expected_schema):
    serialized_schema = doc.serialize_schema(schema)

    assert serialized_schema == expected_schema
Esempio n. 9
0
 class consumes:
     title = doc.String("lock title for public")
     description = doc.String("description only for admin")
     lock_until = doc.Date("YYYY-MM-DD")
     no_update = doc.Boolean("Should do switch_update(dev only)")
Esempio n. 10
0
 class consumes:
     unlock_date = doc.Date(
         "Set unlock date. if not provided will unlock immediately")
Esempio n. 11
0
class GetResponseEntry:
    id = doc.Integer("The id of the entry.")
    uri = doc.String("Uri of the web ID of the entry")
    lblod_id = doc.String("Uri of the lblod id of this entry.")
    date_created = doc.Date(
        "The date on which the entry was added to the database.")
Esempio n. 12
0
 }),
 (doc.Boolean, {
     "type": "boolean"
 }),
 (doc.Boolean(), {
     "type": "boolean"
 }),
 (date, {
     "type": "string",
     "format": "date"
 }),
 (doc.Date, {
     "type": "string",
     "format": "date"
 }),
 (doc.Date(), {
     "type": "string",
     "format": "date"
 }),
 (datetime, {
     "type": "string",
     "format": "date-time"
 }),
 (doc.DateTime, {
     "type": "string",
     "format": "date-time"
 }),
 (doc.DateTime(), {
     "type": "string",
     "format": "date-time"
 }),