Git Product home page Git Product logo

Comments (7)

podhmo avatar podhmo commented on June 15, 2024

https://travis-ci.org/podhmo/swagger-marshmallow-codegen/jobs/580537371

from swagger-marshmallow-codegen.

podhmo avatar podhmo commented on June 15, 2024
class A(Schema):
    nums = fields.List(fields.Integer(), validate=[ItemsRange(min=1, max=10), Unique()])
  File "swagger_marshmallow_codegen/tests/dst/00items.py", line 12, in A
    nums = fields.List(fields.Integer(), validate=[ItemsRange(min=1, max=10), Unique()])
  File "$HOME/venvs/my/swagger-marshmallow-codegen/swagger_marshmallow_codegen/validate.py", line 67, in __init__
    super().__init__(*args, **kwargs)
  File "$HOME/venvs/my/lib/python3.7/site-packages/marshmallow/validate.py", line 216, in __init__
    min_op=self.message_gte if self.min_inclusive else self.message_gt
KeyError: 'min'

from swagger-marshmallow-codegen.

podhmo avatar podhmo commented on June 15, 2024

min_inclusive and max_inclusive options are supported, officially?
And interface is changed?

from swagger-marshmallow-codegen.

podhmo avatar podhmo commented on June 15, 2024

hmm

marshmallow

  • min_inclusive, max_inclusive
  • default is True

openapi

so,

  • jsonschema's minimum=10 as min=10 and inclusive_min=True
  • jsonschema's exclusiveMinimum=10 as min=10 and inclusive_min=False

from swagger-marshmallow-codegen.

podhmo avatar podhmo commented on June 15, 2024

AdditonalProperty support is also broken.

from swagger_marshmallow_codegen.schema import AdditionalPropertiesSchema
from marshmallow import fields


class S(AdditionalPropertiesSchema):
    name = fields.String()


S().load({"name": "foo", "value": 10})
marshmallow.exceptions.ValidationError: {'value': ['Unknown field.']}

from swagger-marshmallow-codegen.

podhmo avatar podhmo commented on June 15, 2024

yeah, this hook is not worked.

def wrap_dynamic_additionals(self, data):
diff = set(data.keys()).difference(self.fields.keys())
for name in diff:
f = self.opts.additional_field
self.fields[name] = f() if callable(f) else f
return data

since.

marshmallow-code/marshmallow@06aea4a

from swagger-marshmallow-codegen.

podhmo avatar podhmo commented on June 15, 2024

this is error. because using fields.Field()

from marshmallow import Schema, fields


class Product(Schema):
    product_id = fields.String()
    description = fields.String(description="Description of product.")


class ProductList(Schema):
    products = fields.List(fields.Field(Product))

use fields.NestedField.

from swagger-marshmallow-codegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.