
from marshmallow import Schema, fields

__author__ = 'lundberg'


class FluxStandardAction(Schema):

    class Meta:
        strict = True

    type = fields.String(required=True)
    payload = fields.Raw(required=False)
    error = fields.Boolean(required=False)
    meta = fields.Raw(required=False)


from marshmallow import Schema, fields, validates_schema, ValidationError

__author__ = 'lundberg'


class EduidSchema(Schema):

    class Meta:
        strict = True

    @validates_schema(pass_original=True)
    def check_unknown_fields(self, data, original_data):
        for key in original_data:
            if key not in self.fields:
                raise ValidationError('Unknown field name: {!s}'.format(key))


class FluxStandardAction(EduidSchema):

    type = fields.String(required=True)
    payload = fields.Raw(required=False)
    error = fields.Boolean(required=False)
    meta = fields.Raw(required=False)

Add a schema with some functionality to inherit from
Add a schema with some functionality to inherit from

  
- from marshmallow import Schema, fields
+ from marshmallow import Schema, fields, validates_schema, ValidationError
  
  __author__ = 'lundberg'
  
  
- class FluxStandardAction(Schema):
+ class EduidSchema(Schema):
  
      class Meta:
          strict = True
+ 
+     @validates_schema(pass_original=True)
+     def check_unknown_fields(self, data, original_data):
+         for key in original_data:
+             if key not in self.fields:
+                 raise ValidationError('Unknown field name: {!s}'.format(key))
+ 
+ 
+ class FluxStandardAction(EduidSchema):
  
      type = fields.String(required=True)
      payload = fields.Raw(required=False)
      error = fields.Boolean(required=False)
      meta = fields.Raw(required=False)
  
Add a schema with some functionality to inherit from
## Code Before:

from marshmallow import Schema, fields

__author__ = 'lundberg'


class FluxStandardAction(Schema):

    class Meta:
        strict = True

    type = fields.String(required=True)
    payload = fields.Raw(required=False)
    error = fields.Boolean(required=False)
    meta = fields.Raw(required=False)

## Instruction:
Add a schema with some functionality to inherit from
## Code After:

from marshmallow import Schema, fields, validates_schema, ValidationError

__author__ = 'lundberg'


class EduidSchema(Schema):

    class Meta:
        strict = True

    @validates_schema(pass_original=True)
    def check_unknown_fields(self, data, original_data):
        for key in original_data:
            if key not in self.fields:
                raise ValidationError('Unknown field name: {!s}'.format(key))


class FluxStandardAction(EduidSchema):

    type = fields.String(required=True)
    payload = fields.Raw(required=False)
    error = fields.Boolean(required=False)
    meta = fields.Raw(required=False)
