class ScheduledAnalysisSchema(BaseSchema): analysis_system_instance = fields.Url(required=True) sample = fields.Url(required=True) analysis_scheduled = fields.DateTime(required=True) priority = fields.Int(required=True)
class TaskSchema(Schema): id = fields.Int(dump_only=True) name = fields.Str() description = fields.Str() creation_date = fields.DateTime() tags = (fields.Nested('TagSchema', many=True, only=["name"]))
class Father(Schema): name = fields.Str(required=True) age = fields.Int(required=True) cpf = fields.Str()
class ExampleSchema(Schema): _id = fields.Int(data_key='id') _global = fields.Int(data_key='global') class Meta: exclude = ('_global', )
class CategorySchema(Schema): id = fields.Int() name = fields.Str(required=True) breed = fields.Str(dump_only=True)
class ExampleSchema(Schema): _id = fields.Int(data_key="id") _global = fields.Int(data_key="global") class Meta: exclude = ("_global",)
def test_field_with_doc_default_and_missing(self, openapi): field = fields.Int(doc_default=42, missing=12) res = openapi.field2property(field) assert res['default'] == 42
class FundSchema(Schema): currency = fields.String() amount = fields.Float() receiver = fields.Int()
class RoleSchema(Schema): id_role = fields.Int(dump_only=True) role_name = fields.Str(required=True) name = role_name description = fields.Str(required=True) id = id_role
from apispec.ext.marshmallow import MarshmallowPlugin from apispec_webframeworks.flask import FlaskPlugin from marshmallow import Schema, fields # Create an APISpec spec = APISpec( title="Wallet System", version="1.0.0", openapi_version="3.0.2", plugins=[FlaskPlugin(), MarshmallowPlugin()], ) # Define schemas UserFields = Schema.from_dict({ "id": fields.Int(), "username": fields.String(), "email": fields.String(), "main_currency": fields.String(), "role": fields.String() }) TransactionFields = Schema.from_dict({ "id": fields.Int(), "sender": fields.Int(), "receiver": fields.Int(), "amount": fields.Float(), "currency": fields.String(), "isapproved": fields.Boolean() })
class WalletSchema(Schema): id = fields.Int() currency = fields.String() owner = fields.Nested(UserFields) balance = fields.Float() transactions = fields.Nested(TransactionFields)
class InterfaceAddressSchema(Schema): id = fields.Int(dump_only=True) interface_id = fields.Int(dump_only=True) cidr = fields.String(required=True)
def delete_workflow_run(runid): if logging == "True": app.logger.info( str(datetime.datetime.now().time()) + ":POST workflowexecution delete - " + runid + " PID:" + str(os.getpid())) response = Response(json.dumps(app.db.deleteRun(runid))) response.headers['Content-type'] = 'application/json' return response #Extract documents from the bundle collection by the \id{run\_id} of a \emph{WFExecution} paging = { 'start': fields.Int(required=True, description="index of the starting item"), 'limit': fields.Int(required=True, description="max number of items expected") } queryargsbasic = { 'terms': fields.Str( description= "csv list of metadata or parameter terms. These relate positionally to the maxvalues and the minvalues" ), 'maxvalues': fields.Str( description= "csv list of metadata or parameters maxvalues. These relate positionally to the terms and the minvalues" ),
class RegionSchema(Schema): id = fields.Int(dump_only=True) name = fields.Str(required=True, validate=validate.Length(min=3, max=100)) description = fields.Str(required=True, validate=validate.Length(min=3)) image = fields.Str(dump_only=True) slug = fields.Str(dump_only=True)
def test_observed_field_name_for_required_field(self, openapi): fields_dict = {"user_id": fields.Int(data_key="id", required=True)} res = openapi.fields2jsonschema(fields_dict) assert res["required"] == ["id"]
class EventsSchema(Schema): id_event = fields.Int(dump_only=True) name = fields.Str(required=True)
class Child(Schema): i = fields.Int() j = fields.Int()
class ProfileSchema(Schema): id = fields.Int() u_id = fields.Int(load_only=True) image = fields.String()
class TaskInstanceCollectionSchema(Schema): """Task instance collection schema""" task_instances = fields.List(fields.Nested(TaskInstanceSchema)) total_entries = fields.Int()
class SkillSchema(Schema): id = fields.Int(load_only=True) skill_name = fields.String()
class ExampleSchema(Schema): id = fields.Int()
class HobbieSchema(Schema): id = fields.Int(load_only=True) hobbie_name = fields.String()
class UserSchema(Schema): _id = fields.Int()
class BlobListItemResponseSchema(ObjectListItemResponseSchema): blob_name = fields.Str(required=True, allow_none=False) blob_size = fields.Int(required=True, allow_none=False) blob_type = fields.Str(required=True, allow_none=False) last_seen = UTCDateTime(required=True, allow_none=False)
class PageSchema(Schema): offset = fields.Int() limit = fields.Int()
class ImageSchema(Schema): height = fields.Int(allow_none=True) url = fields.Url(allow_none=True) width = fields.Int(allow_none=True)
class TagSchema(Schema): id = fields.Int(dump_only=True) name = fields.Str() description = fields.Str() creation_date = fields.DateTime()
class UserSchema(Schema): _id = fields.Int() class Meta: title = "User" fields = ("_id", "email")
class Child(Father): name = fields.Str(required=False) age = fields.Int(required=False)
class StatusQuerySchema(BaseQuerySchema): status = fields.Int() class Meta: strict = True