Skip to content

Schemas #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 28, 2018
Merged

Schemas #190

merged 7 commits into from
Jun 28, 2018

Conversation

samuelcolvin
Copy link
Member

@samuelcolvin samuelcolvin commented Jun 3, 2018

implement #129

Sadly the syntax I has hoped to use (tuples of default, Schema) doesn't work since tuple packing with variable type annotations turns out to be a syntax error (referenced in parsing python/typing#258) it works with parentheses but that's annoying.

Instead I've moved the default declaration into the schema

class FoobarModel(BaseModel):
    foo: int = Schema(4, title='Foo Title')
    bar: str = Schema(..., description='this description of bar')

@codecov
Copy link

codecov bot commented Jun 3, 2018

Codecov Report

Merging #190 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #190   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10     10           
  Lines        1209   1253   +44     
  Branches      224    232    +8     
=====================================
+ Hits         1209   1253   +44

@samuelcolvin samuelcolvin mentioned this pull request Jun 11, 2018
@@ -32,11 +32,21 @@ class Validator(NamedTuple):
check_fields: bool


class Schema:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a docstring and/or comment would be helpful here to know what this class is for.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do, I need to do docs for this in general.

@samuelcolvin
Copy link
Member Author

Needs docs, but otherwise think this is ready.

@Gr1N
Copy link
Contributor

Gr1N commented Jun 25, 2018

@samuelcolvin PR looks great! When you're plan to merge and release change?

@samuelcolvin
Copy link
Member Author

Just needs docs. I'll do it soon.

@samuelcolvin samuelcolvin merged commit dd8d013 into master Jun 28, 2018
@samuelcolvin samuelcolvin deleted the schema branch June 28, 2018 12:06
alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
* starting Arguments

* arguments validator WIP

* working on validate_args_pair

* arguments validator compiling

* starting tests

* WIP JSON args mapping

* fix argument mapping for json

* fix tests, add comment about build_args

* tweaking argument errors

* missing tuple args

* fix tuple tests

* using new errors

* mapping positional arguments

* fix too_long and too_short errors

* linting

* converting kwarg errors

* improve coverage

* improve coverage

* add always_validate_kwargs

* allow *args with zero arguments

* fix extra args with args mapping

* error on repeat arguments

* validator decorator and more coverage

* skip positional only args tests for <3.10

* fix for python <3.10

* separate build_validate_generic_mapping

* Arguments, take 2 (pydantic#203)

* WIP moving to lookup item for args

* Arguments take 2

* adding var_args and var_kwargs handling

* new arguments logic working

* fixing tests

* Non-default argument follows default arguments

* test aliases

* test kwargs

* fix unexpected_positional_argument

* improve coverage

* PyArgs use tuple, not list

* coverage and tweaks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants