Commit Graph

185 Commits

Author SHA1 Message Date
Gustavo Satheler d90def3c4e Add to upper function for strings and bytes (#4165)
* feat: add to upper function for strings and bytes

* docs(changes): add message for change

* fix: add constr upper on types

* fix: add constr upper on types

* feat: add examples and doc usage

* test: add test to upper for types

* chore: apply suggestions from code review

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>

* chore(docs): reorder `anystr_upper` to under `anystr_lower`

* fix(test): adjust parametrizes to constrained bytes upper

* refactor: use pytest parametrize for unify test constrained str upper

* refactor: use pytest parametrize for unify test constrained str lower

* refactor(test): use pytest parametrize for unify test any str upper

* refactor(test): use pytest parametrize for unify test any str lower

* refactor(test): use pytest parametrize for unify test constrained bytes lower

* refactor(test): use pytest parametrize for unify test any str strip whitespace

* refactor(test): change test signatures to improve readability

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-08-08 17:06:00 +01:00
Lily Wang b42fae081c Add nested json encoding (#3941)
* add nested json encoding

* fix timezones

* add changes doc

* split tests and rename example

* Update changes/3941-lilyminium.md

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* split tests into functions

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-08-08 15:46:51 +00:00
Mateo Aguirre Duque 7431683e88 Alias support in decorator validate_arguments (#3019)
* add support for alias handling in validate_arguments

* add test for alias handling in validate_arguments

* add documentation on alias support for decorator

* bug fixed in the validate_argumen decorator documentation

* add changes README

* change in the documentation due to a drafting error

* Update changes/3019-MAD-py.md

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>

* more challenging tests

* run the format checker

* integration of empty string as alias

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-08-08 13:33:51 +01:00
Eric Jolibois 576e4a3a8d refactor: change pydantic dataclass decorator (#2557)
* refactor: rewrite the whole pydantic dataclass logic

* test: add tests for issue 2162

* test: add tests for issue 2383

* test: add tests for issue 2398

* test: add tests for issue 2424

* test: add tests for issue 2541

* test: add tests for issue 2555

* refactor: polish

* change default and support 3.6

* fix coverage

* fix mypy and text

* typos

* test: add tests for issue 2594

* fix: forward doc for schema description

* add change

* chore: small changes from review

* refactor: avoid extra __pydantic_run_validation__ parameter

* small tweaks

* remove wrapper

* support 3.6

* fix: mypy

* rewrite doc

* add docs

* wrapper is removed now

* a bit more docs

* code review

* faster dict update

* add test for issue 3162

* add test for issue 3011

* feat: add `Config.post_init_after_validation`

* allow config via dict

* fix cython and TypedDict

* chore: typo

* move `compiled` in `version.py`

* refactor: switch from `Config.post_init_after_validation` to \'post_init_call`

* add dataclass isinstance support

* avoid multi paragraphs in change file

* feat: support `Config.extra`

* refactor: simplify a bit code

* refactor: avoid creating useless functions

* refactor: simplify `is_builtin_dataclass`

* support extra in post_init

* docs: add warning on config extra

* fix #3713 compatibility

* update docs

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-08-04 12:06:54 +01:00
Hernán Alarcón eadfdbdbde Fix mypy error in models_recursive.py example. (#3995) 2022-07-21 08:52:44 +02:00
Eric Jolibois edad0dbc46 fix: keep old behaviour of json() by default (#3542)
* fix: handle basemodel fallback for custom encoders

* put back old behaviour and add to_dict

* typo

Co-authored-by: Christian Bundy <christianbundy@fraction.io>

Co-authored-by: Christian Bundy <christianbundy@fraction.io>
2021-12-24 13:14:13 +00:00
Eric Jolibois 81b13ff3b4 fix: rename schema util into schema_of (#3547) 2021-12-22 19:42:56 +00:00
Mark Trifonov be246701c5 Nested env (#3159)
* Environment names for complex types #2304

* nested env disabled by default

* cleanup

* nested env settings: simplified and mypy fixes

* nested env settings: config, test, doc

* nested env settings: changes file

* nested env settings: cleanup

* Apply suggestions from code review

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Apply suggested changes from code review

* lint fix

* changes from code review

* simplify explosing env vars

* linting

Co-authored-by: Mark Trifonov <>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-12-18 20:56:14 +00:00
Jaakko Moisio 63337fbadc Add optional field argument to __modify_schema__() (#3434)
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-12-18 20:55:22 +00:00
Marcelo Trylesinski 7eaa582980 Add AmqpDsn class (#3254)
* Add RabbitmqDsn

Will update once finished - haven't looked at the CONTRIB yet. Want to test locally to see if it works.

* added tests; added to docs

* added changes

* fixed import in networks.py

* fixed linting issues; fixed __init__.py import issue

* sorted imports

* added trailing comma on imports

* Merge master

* Change class name from RabbitmqDsn to RabbitMqDsn

* Format code

* Rename change file and prettify content

* Fix RabbitMQ name on documentation

* Add a trivial test

* Address Samuel and Nuno's comments

* Refactor AMQP tests according to Redis tests style

* Update docs/examples/settings_main.py

* cleanup

Co-authored-by: Thomas <thomas@9bitbyte.com>
Co-authored-by: Thomas Crha <tom.crha@dragonflytechnologies.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-12-18 20:40:16 +00:00
Eric Jolibois c834f3419d Support discriminated union (#2336)
* feat: add discriminated union

* feat: add OpenAPI spec schema

* test: add basic example for generated schema

* test: add validation tests

* docs: add basic documentation

* fix: support ForwardRef

* test: add ForwardRef case

* fix: false positive lint error

https://github.com/PyCQA/pyflakes/pull/600

* improve error

* add schema/schema_json utils

* fix tests after merge

* refactor: add `discriminator` attribute to `FieldInfo`

* refactor: @cybojenix remarks

* fix schema with forward ref

* start nested

* feat: add allowed values in error message

* fix wrong check

Same example with

```
class FooDomainA(BaseModel):
    __root__: Union[FooDomainAA, FooDomainAB]
```

(without a discriminator)
should obviously be valid

* test: add nested examples

* remove uncovered code as we don't need it

* docs: add nested example

* fix: support properly Annotated Field syntax

* support naked annotated

* fix: handle TypeError

* make error loc more explicit

* fix behaviour with basemodel instance as value

* support schema for dataclasses

* tweak examples

* refactor: context manager just around code that fails

* refactor: add docstring + tweak on `get_sub_types`

* refactor: move `get_discriminator_values` in `utils.py`

* refactor: create `MissingDiscriminator` and `InvalidDiscriminator`

* refactor: move logic in `_validate_discriminated_union`

* refactor: remove `DiscriminatedUnionConfig`

* docs: schema/schema_json

* tests: add tests with other `Literal` types

* update 3.10

* add schema docstring

* weird bug on 3.8 with `Literal[None]`

* bump to view docs & coverage

* bump to prompt tests

* move tests in dedicated file

* chore: rewording

* refactor: replace property by direct slot

* refactor: faster check

* refactor: missing discriminator

* refactor: change error to ConfigError

* refactor: use display_as_type

* fix: mypy

* fix: duplicate

* feat: handle alias

* feat: handle nested unions

* tweak first example

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-12-18 16:31:35 +00:00
Michael Rios 043d16bcf8 Update validator function name in examples to show that value must b… (#3327)
* Update validator function name in  examples to show that value must be bar vs must contain a space

* Add md file in
2021-12-08 23:17:08 +00:00
Eric Jolibois 458f257dcb feat: make JSON serialization of referenced pydantic models possible (#2650)
* feat: make JSON serialization of referenced pydantic models possible

* add docs

* chore: @samuelcolvin remarks
2021-12-07 22:01:11 +00:00
Eric Jolibois c38c463137 feat: add Config.smart_union option (#2092)
* feat: add `Config.smart_union` to prevent coercion in `Union` if possible

* docs: write some documentation

* Update docs/usage/model_config.md

Thanks @djpugh

Co-authored-by: David J Pugh <6003255+djpugh@users.noreply.github.com>

* improve doc

* support 3.10

* improve smart_union

* Update docs/usage/types.md

Co-authored-by: David J Pugh <6003255+djpugh@users.noreply.github.com>

* put new sentence inside warning block

* docs: reorder

* rename is_union_origin into is_union

* inverse and condition for perf

* fix doc

Co-authored-by: David J Pugh <6003255+djpugh@users.noreply.github.com>
2021-12-07 21:58:52 +00:00
q0w 4af50043f1 docs: Print name classes for __concrete_name__ example (#3470)
* Print name classes

* use `repr` to display class name

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
2021-12-07 10:45:39 +01:00
Yurii Karabas 415eb54f96 Try to evaluate forward refs after model created (#2588)
* Try to evaluate forward refs after model created

* Upadate docs and remove code duplication

* Update changes/2588-uriyyo.md

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>

* Update docs/usage/postponed_annotations.md

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>

* Remove unused import

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
2021-12-05 14:20:48 +00:00
Nuno André b718e8e626 Add GetterDict example (#2463)
* Add GetterDict example

* Update docs/usage/models.md

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2021-05-12 15:25:17 +01:00
Davis Kirkendall db697cc799 Add exclude as field parameter (#2231)
* Add exclude/include as field parameters

- Add "exclude" / "include" as a field parameter so that it can be
  configured using model config (or fields) instead of purely at
  `.dict` / `.json` export time.
- Unify merging logic of advanced include/exclude fields
- Add tests for merging logic and field/config exclude/include params
- Closes #660

* Precompute include/exclude fields for class

* Increase test coverage
* Remove (now) redundant type checks in Model._iter: New
  exclusion/inclusion algorithms guarantee that no sets are passed further down.

* Add docs for advanced field level exclude/include settings

* Minimal optimization for simple exclude/include export

Running benchmarks this vs. master is at:

this: pydantic best=33.225μs/iter avg=33.940μs/iter stdev=1.120μs/iter version=1.7.3
master: pydantic best=32.901μs/iter avg=33.276μs/iter stdev=0.242μs/iter version=1.7.3

* Apply review comments on exclude/enclude field arguments

* Fix/simplify type annotations
* Allow both ``True`` and ``Ellipsis`` to be used to indicate full field
  exclusion
* Reenable hypothesis plugin (removed by mistake)
* Update advanced include/include docs to use ``True`` instead of ``...``

* Move field info exclude/include updates into FieldInfo class

This way, the model field object does not need to concern itself with
dealing with field into specific fields.
(Same was done for alias in a previous commit).

* remove double back tick in markdown.

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2021-05-01 16:45:37 +01:00
Eric Jolibois 3ec35590f1 Support Field in dataclass + 'metadata' kwarg of dataclasses.field (#2384)
* Support `Field` in `dataclass` + `'metadata'` kwarg of `dataclasses.field`

Please enter the commit message for your changes. Lines starting

* add `__has_field_info_default__` for minimal effect on perf

* lower complexity of `_process_class`
2021-02-25 20:04:16 +00:00
Tom Cobb 3f849a368f Support Field(default_factory) in validate_arguments (#2176)
* Support Field(default_factory) in validate_arguments

* Added docs for validate_arguments with Field
2021-02-23 12:07:11 +00:00
Arseny Boykov ce67660d2f Allow to configure models through class kwargs (#2356)
* add support for class kwargs config

* reformat tests

* add changes file and docs

* fix linting in 'inherit_config'

* tweak docs

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-02-22 17:10:04 +00:00
Samuel Colvin b7a8ef25c6 fix coverage and make typing-extensions a required dependency (#2368)
* fixing coverage by simplifying Annotated import logic, fix #2367

* avoid checking against annotated if it's None

* make typing-extensions required WIP

* more making typing-extensions required

* fix docs and get_origin for python 3.6

* fix mypy test

* fix docs

* update docs, cleanup and add change

* clean docs/examples/schema_annotated.py

* move AnnotatedTypeNames
2021-02-17 19:17:30 +00:00
Jacob Hayes b742c6f527 Support Annotated type hints and extracting Field from Annotated (#2147)
* Infer root type from Annotated

* Extract Field from Annotated

* Add changelog

* Extend existing get_args/get_origin

* Fix Annotated on py3.6 without typing-extensions

* Handle Ellipsis default

* Fix field reuse after FieldInfo.default mutation

* Fix ci
2021-02-13 16:13:21 +00:00
Arthur Pastel 33c5a4dc34 Add merged json_encoders inheritance (#2064)
* Implement merged json_encoders inheritance

* json_encoders inheritance documentation
2021-02-13 15:56:34 +00:00
Anthony King b4d1ada004 fix(decorator): detect when a duplicate argument is passed in (#2250)
* fix(decorator): detect when a duplicate argument is passed in

Currently, it is possible to override a positional argument with a keyword
argument using the decorator.

In native python, this raises a TypeError.

Detect this usecase, to prevent keywords overriding positional parameters.

Closes: https://github.com/samuelcolvin/pydantic/issues/2249

* add changelog entry

* fix docs example to not override positional argument

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-02-13 11:06:12 +00:00
Eric Jolibois c314f5a909 feat: add support for NamedTuple and TypedDict types (#2216)
* feat: add support for `NamedTuple` and `TypedDict` types

* support `total=False`

* tests: fix ci with python < 3.8 without typing-extensions

* chore: improve mypy

* chore: @samuelcolvin remarks

* refactor: move tests in dedicated file

* docs: add annotated types section with examples

* feat: support properly required and optional fields

* chore(deps-dev): bump typing_extensions

* docs: add a note for `typing_extensions`

* chore: update message to be more accurate

* feat: pass down config to created models

* feat: add util methods to create model from TypedDict or NamedTuple

* refactor: rename into typeddict and namedtuple

* test: add utils tests

* chore: fix lint

* chore: improve test

* refactor: rename utils to match the rest

* chore: update change

* docs: add section for create_model_from_{namedtuple,typeddict}

* refactor: rename typed_dict/named_tuple

* feat: support schema with TypedDict

* feat: support schema for NamedTuple

* feat: add json support for NamedTuple

* chore: rewording

* refactor: use parse_obj

* fix: add check for max items in tuple

* docs: separate typing.NamedTuple and collections.namedtuple
2021-02-13 10:05:57 +00:00
Eric Jolibois f11b3ae313 feat: avoid reconstructing models used as fields of another model on validation (#2193)
* feat: avoid reconstructing models used as fields of another model on validation

closes #265
closes #1837

* docs: add section to change config

* change default value to avoid breaking change

* refactor: only suggest custom BaseModel approach
2021-02-12 13:04:52 +00:00
Eyitayo Ogunbiyi 61b45340e7 Feature/add anystr lower to config (#2183)
* added anystr_lower field to config

* updated docs with any anystr_lower config property

* updated changes folder with markdown describing new change

* added anystr to _validators list under bytes type

* added unit tests for anystr_lower config

* Update pydantic/validators.py

Fix wrong method used in cosntr_lower

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>

* added lower_str to conbytes and constr functions

* Update changes/2134-tayoogunbiyi.md

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* renamed conbytes & constr paramater name

* updated change markdown

* added docs for args to constr and conbytes

* added examples to showing to_lower functionality in conbytes & constr

* added better description for curtail_length

* removed unessary whitespace, added default and types in docs

* Update changes/2134-tayoogunbiyi.md

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>

* added single whitespace to arguments list under constr & conbytes

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-02-12 12:28:08 +00:00
Thomas Berdy 1155de82b9 feat: Add the ability to add extra settings sources (#2107)
* feat: Add the ability to add extra settings sources

* doc: Document "customise settings sources" feature

* tests: Add missing test and add change file

* Update changes/2107-kozlek.md

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>

* improve docs for settings customise_sources

* fix docs building

* fix test :-(

Co-authored-by: Thomas Berdy <thomas.berdy@outlook.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-02-11 16:55:40 +00:00
Zac Hatfield-Dodds 771b0d3d92 Add a Hypothesis plugin (#2097)
* Configure Hypothesis

* Hypothesis plugin docs

* Add Hypothesis plugin

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2021-02-11 12:33:11 +00:00
Eric Jolibois 8bad7bc911 feat: add validate method on function to validate input without calling it (#2128)
* feat: add `validate` method on function to validate input without calling it

* docs: add documentation

* chore: add change file
2020-12-31 17:45:51 +00:00
Mykola Solodukha aacf592040 Add rediss (Redis over SSL) protocol to RedisDsn (#1911)
* Add `rediss` (Redis over SSL) protocol to `RedisDsn`

* Update docs

* Update changes history

* Fix typo in `changes/1911-TrDex.md`

Co-authored-by: PrettyWood <em.jolibois@gmail.com>

* Bump black from 19.10b0 to 20.8b1 (#1909)

* Bump black from 19.10b0 to 20.8b1

Bumps [black](https://github.com/psf/black) from 19.10b0 to 20.8b1.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/master/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* fix: run `make format`

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: PrettyWood <em.jolibois@gmail.com>

* Allow URLs without `user` part

Refer to #1877

* Update docs

* Allow Redis DSN with schema only

Refer to https://github.com/samuelcolvin/pydantic/pull/1911#issuecomment-722335692
Refer to https://www.iana.org/assignments/uri-schemes/prov/redis

* Fix lint error

* Fix lint error

* Set `parts: Dict[str, Optional[str]]` instead of `Dict[str, str]`

* Fix linting

* More verbose default values set in `RedisDsn.validate_parts()`

* Fix linting 2

* Fix typo in docs

* Add a note in the changelog

* Add test case for URL without `user` part

* change port in test

Co-authored-by: PrettyWood <em.jolibois@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-12-30 18:20:51 +00:00
Rick Izzo 465f267c7d Added StrictBytes type (#2136)
* Added StrictBytes type

* updated tests for StrictBytes, updated relevant sections in documentation for StrictBytes and ConstrainedBytes

* added changelog

* chore: typo in change

Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
2020-12-01 01:18:35 +01:00
Matthew Davis 9cb7ca744b add NonPositive/NonNegative Int/Float (#1987)
fix #1975

* add NonPositive/NonNegative Int/Float

* delete data.json file
2020-11-29 16:07:51 +00:00
Eric Jolibois b3f7b28f13 fix: forward all the params of the stdlib dataclass when converted into _pydantic_ dataclass (#2066)
* fix: forward all the params of the stdlib `dataclass` when converted into _pydantic_ `dataclass`

closes #2065

* add some documentation
2020-10-31 18:45:20 +00:00
Eric Jolibois 0b9cd4e537 fix: pydantic dataclass can inherit from stdlib dataclass and arbitrary_types_allowed is supported (#2051)
* fix: pydantic dataclasses can inherit from stdlib dataclasses

closes #2042

* docs: add some documentation

* fix: support arbitrary_types_allowed with stdlib dataclass

closes #2054

* docs: add documentation for custom types
2020-10-28 19:10:55 +00:00
PrettyWood c83156d0e0 feat: make pydantic dataclass decorator support built-in dataclass (#1817)
* feat: pydantic dataclasses support built-in ones

closes #744

* feat: improve dataclass typing

* feat: add support for nested dataclasses

closes #1743

* feat: support dataclass schema with nested dataclasses

* refactor: remove `_dataclass_with_validation` function

* docs: add docstring for `make_dataclass_validator`

* refactor: rename DataclassType into Dataclass

The name `DataclassType` was missleading as it's not a `Type` per say.

* refactor: change global `dataclass` import to local

pydantic import time was improved in
https://github.com/samuelcolvin/pydantic/pull/1132
by keeping `dataclass` import local. So let's keep it that way!

* test: add extra nested case with BaseModel

* chore: s/pydantic/_pydantic_/g

* docs: add some documentation
2020-10-26 11:09:28 +00:00
Arseny Boykov 664cbcfc01 Add private attributes support (#1679)
* Add private attributes support

* Add more blank lines in example

* Add changes file

* Update docs/usage/models.md

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* fix after bad merge

* Add PrivateAttr, Config.underscore_attrs_are_private

* remove unrelated change in utils.py

* add   # noqa: C901 (ignore complexity) to __setattr__
(see comment in PR)

* add annotation to Config.underscore_attrs_are_private

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* use sunder names

* mention underscore_attrs_are_private in model_config.md

* add comment about default factory

* fix comment

* fix comment

* clarify that both dunder and sunder names might be used

* tweak docs and name

* _set_default_private_attributes -> _init_private_attributes

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* use new name _init_private_attributes

* move tests

* copy private attributes in BaseModel.copy()

* add test for default and default_factory used together

* fix linting

* more tests, default_factory kw only

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-10-26 09:47:40 +00:00
Chris Hoogeboom 0af5e5f559 Allow generics to extend concrete classes. fixes #2005 (#2006)
* Allow generics to extend concrete classes. fixes #2005

* Update the docs

* Updote the changes

* Convert double quotes to single quotes

* Fix formatting

* Add a check for data

* Update example

* Add a skip_36 decorator that got accidentally deleted when resolving conflicts.
2020-10-25 19:22:25 +00:00
Benjamin Sitruk e00dba322b Docs: Add validators to dynamic model (#1963)
* Add dynamic validators to doc

* Update models_dynamic_validators.py

* Update models_dynamic_validators.py

* Adding example (success and error)

* Update models_dynamic_validators.py
2020-10-25 17:57:08 +00:00
Tyler Wozniak 3e4c1b5714 Adding deque to valid field types (#1935)
* Adding deque to valid field types

* Added missing type example

* Fix bad copy-paste

Co-authored-by: PrettyWood <em.jolibois@gmail.com>

* correct enum validator name

* correct enum validator name, take2

Co-authored-by: PrettyWood <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-10-25 17:52:34 +00:00
Samuel Colvin a25aba26b5 linting as a separate CI step (#2030)
* linting as a separate ci step

* CI and docs improvements

* fix docs preview

* fix docs, benchmarks fastapi tests

* fix formatting and docs build

* tweak publishing docs

* fix for new download-artifact action

* skip check tag to check docs build

* prepare for merge
2020-10-25 15:03:33 +00:00
Samuel Colvin 8ccc5708f1 remove data.json, fix #1992 (#1994) 2020-10-11 19:34:37 +01:00
Matthew Davis 094da94da9 clarify argument type to parse_file (#1795)
Co-authored-by: Matthew Davis <Matthew.Davis.2@team.telstra.com>
2020-10-08 21:10:09 +01:00
Samuel Colvin 9c4860ce96 Valdiate arguments config (#1663)
* add `configs` to validate_arguments

* simplify `validate_arguments` and add annotation for parameter `configs`

* change double quotes to single quotes

* reformat code

* fix mypy error

* fix mypy 'maximum semantic analysis' error

* rename 'configs' > 'config_params'

* change name and usage, start tests

* prevent setting fields on custom config

* add docs and fix mypy

* tweak docs

* add change

Co-authored-by: quantpy <quantpy@qq.com>
2020-09-06 23:17:52 +01:00
Patrick Wang dca98559d5 Add conset (#1627)
* Add conset

* Add changes doc

* Fix too-long lines

* bump

* Update conset change doc formatting

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Robustify test_conset

* Move conlist and conset tests to test_types

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2020-07-03 20:51:23 +01:00
Samuel Eklund 7bd635c21c Subclass validator each item docs (#1592)
* add description of subclass each_item scenario

* add example of subclass validator with each_item

* each_item causes validator to not run when parent class has List field #1566
2020-06-27 14:51:18 +01:00
Koudai Aono 6e29848608 Add datamodel-code-generator link in pydantic document site (#1532)
* Add datamodel-code-generator link in pydantic document site.

* tweak menu

* fix blank lines

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-05-31 15:23:20 +01:00
Samuel Colvin dc094f1211 fix blank lines in docs 2020-05-31 15:05:06 +01:00
Stephen Brown II ba2cc5c557 Make assertion match message (#1533) 2020-05-31 14:57:37 +01:00