Skip to content
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

Make generated Python codes free from validate_*() runtime functions #245

Merged
merged 7 commits into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

__pycache__
.cache
.pytest_cache
.stack-work
*.tix
*.pyc
Expand Down
1 change: 1 addition & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
within:
- Nirum.Parser
- Nirum.ParserSpec
- Nirum.Targets.Python.CodeGenSpec
- ignore: {name: Unnecessary hiding}


Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ before_install:
brew update || true
brew upgrade || true
brew update || true
brew install --with-default-names gnu-sed
brew tap dahlia/homebrew-deadsnakes
brew install python34 python35 python3 || \
brew upgrade python34 python35 python3 || \
Expand Down
29 changes: 29 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,38 @@ To be released.
classes. Nirum type names are qualified and their leading module paths
are also normalized (the same rule to `nirum.modules` applies here).

- All integral types (`int32`, `int64`, and `bigint`) became represented
as [`numbers.Integral`][python2-numbers-integral] instead of
[`int`][python2-int].

There's no change to Python 3.

- The `uri` type became represented as [`basestring`][python2-basestring]
instead of [`unicode`][python2-unicode] in Python 2, since URI (unlike IRI)
is limited to a subset of ASCII character set.

There's no change to Python 3.

- Generated type constructors became to validate field value's range or format
besides class checks: range checks for `int32`/`int64`, time zone
(``tzinfo``) awareness check for `datetime`, and basic format check for
`uri`.

- Fixed a bug that generated service methods hadn't checked its arguments
before its transport sends a payload. [[#220]]

- Fixed a bug that field/parameter names that use a module name of the Python
standard library cause runtime `TypeError`s (due to name shadowing).
Under the hood, all generated `import`s are now aliased with a name prefixed
an underscore.

[#13]: https://github.com/spoqa/nirum/issues/13
[#220]: https://github.com/spoqa/nirum/issues/220
[#227]: https://github.com/spoqa/nirum/pull/227
[entry points]: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points
[python2-numbers-integral]: https://docs.python.org/2/library/numbers.html#numbers.Integral
[python2-basestring]: https://docs.python.org/2/library/functions.html#basestring
[python2-unicode]: https://docs.python.org/2/library/functions.html#unicode


Version 0.3.1
Expand Down
Loading