# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ## [v2.5.0] - 2021-05-23 ### Added - Add support for `int` values for `number` types. ## [v2.4.2] - 2021-04-04 ### Added - Add support for SQLAlchemy 1.4. - Add support for grouping models into schemas. [#294] ## [v2.3.0] - 2021-03-07 ### Added - Add support for OpenAPI 3.1. [#276] ## [v2.2.0] - 2021-01-23 ### Fixed - Removed unnecessary imports in `__init__.py` files. [#255] ### Added - Caching validation results to speed up startup. [#251] ## [v2.1.0] - 2020-12-20 ### Added - Add support for namespaced `x-open-alchemy-` prefix on top of the shorter `x-` prefix for extension properties. [#236] ## [v2.0.2] - 2020-12-19 ### Changed - Changed from `setup.py` to poetry ## [v2.0.1] - 2020-12-08 ### Added - Add version, title and description (if defined) into the JSON OpenAPI specification stored with the package generated by the build module. ## [v2.0.0] - 2020-11-15 ### Added - Add check enforcing unique `x-tablename` values. [#189] - Add check enforcing unique `x-secondary` values. [#189] - Add custom association schemas validation [#189] - Add support for custom association tables [#189] - Add `openalchemy` CLI with a first sub command to build a Python package from a specification file. [#201] - Add a CLI sub command to regenerate models. [#202] - Add support for database default values using `x-server-default`. [#196] ### Changed - Change the association table to no longer be noted on the models based on the `x-secondary` value and instead be noted based on converting the `x-secondary` value from snake_case to PascalCase. Name clashes are avoided by pre-pending `Autogen` as many times as required. [#189] - Change the association table to no longer be constructed as a table and instead to be constructed as another model. [#189] - Refactor column factory to use the schemas artifacts [#196] - Refactor model factory to use the schemas artifacts [#196] ### Fixed - Fix bug where the association table defined for `many-to-many` relationships did not make the foreign key columns referencing the two sides of the relationship primary keys. _This may require a database migration if alembic was used to generate the database schema._ [#189] - Fix bug where some properties were incorrectly picked from a reference even though they existed locally (only impacts relationship properties where, for example, `x-secondary` was defined both on the relationship property in `allOf` and on the referenced model). [#189] ### Removed - Remove `define_all` parameter for `init_model_factory`, `init_json` and `init_yaml`. OpenAlchemy now behaves as though `define_all` is set to `True`. _This means that a pure model reference (a schema with only the `$ref` key) can no longer be used to change the name of a model._ [#189] ## [v1.6.0] - 2020-10-10 ### Added - Add `build_json` and `build_yaml` interfaces which can be used to produce a package with the models. [#190] - Add support for building sdist or wheel distributable archive. ### Changed - Refactor the models file generation to use the artifacts from the schemas. - Changed output of build_json and build_yaml to be contained within a project directory. - Drop support for Python 3.6 and add support for Python 3.9. [#198] ## [v1.5.4] - 2020-08-30 ### Changed - Move `description` to be a top level property artifact for every property. ## [1v.5.3] - 2020-08-29 ### Fixed - Correct `format` key to no longer have a trailing `_` for artifacts. ## [v1.5.2] - 2020-08-29 ### Changed - Expose function that collects artifacts for the models. - Expose function that collects artifacts for the model properties. ## [v1.5.1] - 2020-08-23 ### Added - Add support for arbitrary mix in classes. ## [v1.5.0] - 2020-08-22 ### Added - Add support for generic `format` for `string` that are treated like a `string` without a `format`. - Add interface to check un-managed models for the reason why they are not managed. ### Changed - Change constructable check to no longer check the schema of `x-tablename` and `x-inherits`. - Change schema validation to process properties even if the model is not valid. ## [v1.4.3] - 2020-08-16 ### Removed - Remove dependency on black ## [v1.4.2] - 2020-08-16 ### Fixed - Fix bug where iterating over constructable schemas did not handle some exceptions - Add black dependency back in ## [v1.4.1] - 2020-08-09 ### Removed - Remove black dependency ## [v1.4.0] - 2020-08-09 ### Added - Add schemas pre-processor that extracts the required back references. - Add foreign key pre-processor that extracts the required foreign keys. - Add schema validation pre-processor. - Add function that checks a specification. ## [1.3.0] - 2020-07-12 ### Added - Add support for generic JSON data for properties. - Add support for `writeOnly`. ### Fixed - Fix bug where the name of the foreign key column was based on the table name and not the property name. ## [1.2.0] - 2020-06-08 ### Added - Add support for `__str__` and `__repr__` for model instances. ### Changed - Ring fence `black` dependency. ### Removed - Remove several bugs from the generated models file and integrate with `sqlalchemy-stubs`. ## [1.1.1] - 2020-05-17 ### Added - Add support for `readOnly`. ### Fixed - Fix bug where TypedDIct types for `binary`, `date` and `date-time` string formats mapped to the incorrect python types. - Fix bug where `to_dict` and `to_str` returned `null` for values that are not required and not nullable. ## [1.1.0] - 2020-04-05 ### Added - Add section of documentation for each example. - Add support for keyword arguments for relationships used to define relationship arguments not specifically handled by an extension property. - Add support for kwargs at the model, column and foreign key level. - Add support for single and joined table inheritance. ## [1.0.0] - 2020-03-21 ### Added - Add support for remote references to a file at a URL. - Add support for default values. - Add check for whether the value of an extension property is null. ## [0.14.0] - 2020-02-21 ### Added - Add support for remote references to another file on the file system. ## [0.13.0] - 2020-02-16 ### Added - Add tests for examples. - Add `from_str` and `to_str` to complement `from_dict` and `to_dict` for de-serializing and serializing from JSON. - Add description from OpenAPI specification into the models file. ### Changed - Ring fence SQLAlchemy dependency to a facade and integration tests. - Ring fence jsonschema dependency into a facade. ## [0.12.1] - 2020-01-12 ### Fixed - Fix bug where auto generating models file meant that multiple classes with the same name were registered with the base. ## [0.12.0] - 2020-01-04 ### Added - Add checking whether the column is automatically generated to determining the type of a column. - Add support for `nullable` for object references. - Add type hints for `\_\_init\_\_` and `from_dict`. - Add example for alembic interoperability. ### Changed - Refactor object reference handling to be easier to understand. ### Removed - Remove typing_extensions dependency for Python version 3.8 and later. ### Fixed - Fix bug where format and maxLength was not considered for the foreign key constructed for an object reference. ## [0.11.0] - 2019-12-29 ### Added - Add support for `password` - Add support for `binary` - Add support for `byte` - Add support for `date` - Add optional parameter that can be used to generate a models file for IDE auto complete and type hinting - Add `from_dict` and `to_dict` to the type models file - Add SQLAlchemy information to models file - Add back references to models file ### Changed - Move SQLAlchemy relationship construction behind facade - Move schema calculations into separate files - Refactor handling array references to reduce scope of individual tests and make them easier to understand ## [0.10.4] - 2019-12-18 ### Fixed - Fix bug where some static files where not included in the distribution. ## [0.10.1] - 2019-12-15 ### Added - Add support for DateTime. ### Changed - Refactor column handler to first check the schema, then gather the required artifacts for column construction and then construct the column. ## [0.10.0] - 2019-11-23 [_Beta release_] ### Added - Add check for whether foreign key for relationship is already constructed before automatically constructing it. - Add support for returning parent properties in the child `to_dict` call using `readOnly` properties. - Add support for many to many relationships. ## [0.9.1] - 2019-11-11 ### Fixed - Fix bug where some static files where not included in the distribution. ## [0.9.0] - 2019-11-10 ### Added - Add `from_dict` and `to_dict` functions to all models that are used to construct a model from a dictionary and to convert a model instance to a dictionary, respectively. - Add `x-foreign-key-column` extension property to define a custom foreign key constraint for many to one relationships. - Add `x-composite-unique` extension property at the object level to construct unique constraints with multiple columns. - Add `x-composite-index` extension property at the object level to construct indexes with multiple columns. - Add support for one to one relationships. - Add support for one to many relationships. ### Fixed - Fix bug where `allOf` merging would only return the properties of the last object instead of merging the properties. ## [0.8.0] - 2019-11-03 ### Added - Add less verbose initialisation with `init_yaml` and `init_json`. ### Changed - Update name from OpenAPI-SQLAlchemy to OpenAlchemy ### Removed - Remove need for separate models file by exposing `Base` and constructed models at `open_alchemy.models`. ## [0.7.0] - 2019-10-27 ### Added - Add support for Python 3.6. - Add connexion example application. - Add schema checking for extension properties. ### Fixed - Fixed bug where referencing a schema which uses allOf in many to one relationships does not merge the allOf statement. - Fixed bug where a type hint that is not always exported from SQLAlchemy may cause an no member error. ## [0.6.3] - 2019-10-19 ### Added - Add support for backref for many to one relationships. - Add integration tests for major features. ### Removed - Refactor to remove reference resolving decorator. ## [0.6.2] - 2019-10-19 ### Added - Add support for python 3.8. ## [0.6.1] - 2019-10-19 ### Changed - Update name from openapi-SQLAlchemy to OpenAPI-SQLAlchemy. All urls are expected to keep working. ## [0.6.0] - 2019-10-6 ### Added - Add support for `allOf` for models. ## [0.5.0] - 2019-09-29 ### Added - Add support for `$ref` for models. ### Changed - Refactor column factory to use fewer decorators. - Change exceptions to include the schema name. ## [0.4.0] - 2019-09-21 ### Added - Add support for `allOf` for columns. ## [0.3.0] - 2019-09-08 ### Added - Add support for `autoincrement`. - Add support for `$ref` for columns referencing other table objects. - Add documentation ## [0.2.0] - 2019-08-25 ### Added - Add support for `$ref` for columns. ## [0.1.1] - 2019-08-18 ### Changed - Move typing-extensions development to package dependency. ## [0.1.0] - 2019-08-18 - Initial release - Add support for `integer` columns. - Add support for `boolean` columns. - Add support for `number` columns. - Add support for `string` columns. [//]: # "Release links" [0.1.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.1.0 [0.1.1]: https://github.com/jdkandersson/OpenAlchemy/releases/0.1.1 [0.2.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.2.0 [0.3.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.3.0 [0.4.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.4.0 [0.5.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.5.0 [0.6.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.6.0 [0.6.1]: https://github.com/jdkandersson/OpenAlchemy/releases/0.6.1 [0.6.2]: https://github.com/jdkandersson/OpenAlchemy/releases/0.6.2 [0.6.3]: https://github.com/jdkandersson/OpenAlchemy/releases/0.6.3 [0.7.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.7.0 [0.8.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.8.0 [0.9.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.9.0 [0.9.1]: https://github.com/jdkandersson/OpenAlchemy/releases/0.9.1 [0.10.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.10.0 [0.10.1]: https://github.com/jdkandersson/OpenAlchemy/releases/0.10.1 [0.10.4]: https://github.com/jdkandersson/OpenAlchemy/releases/0.10.4 [0.11.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.11.0 [0.12.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.12.0 [0.12.1]: https://github.com/jdkandersson/OpenAlchemy/releases/0.12.1 [0.13.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.13.0 [0.14.0]: https://github.com/jdkandersson/OpenAlchemy/releases/0.14.0 [1.0.0]: https://github.com/jdkandersson/OpenAlchemy/releases/1.0.0 [1.1.0]: https://github.com/jdkandersson/OpenAlchemy/releases/1.1.0 [1.1.1]: https://github.com/jdkandersson/OpenAlchemy/releases/1.1.1 [1.2.0]: https://github.com/jdkandersson/OpenAlchemy/releases/1.2.0 [1.3.0]: https://github.com/jdkandersson/OpenAlchemy/releases/1.3.0 [v1.4.0]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.4.0 [v1.4.1]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.4.1 [v1.4.2]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.4.2 [v1.4.3]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.4.3 [v1.5.0]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.5.0 [v1.5.1]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.5.1 [v1.5.2]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.5.2 [v1.5.3]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.5.3 [v1.5.4]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.5.4 [v1.6.0]: https://github.com/jdkandersson/OpenAlchemy/releases/v1.6.0 [v2.0.0]: https://github.com/jdkandersson/OpenAlchemy/releases/v2.0.0 [v2.0.1]: https://github.com/jdkandersson/OpenAlchemy/releases/v2.0.1 [v2.0.2]: https://github.com/jdkandersson/OpenAlchemy/releases/v2.0.2 [v2.1.0]: https://github.com/jdkandersson/OpenAlchemy/releases/v2.1.0 [v2.2.0]: https://github.com/jdkandersson/OpenAlchemy/releases/v2.2.0 [v2.3.0]: https://github.com/jdkandersson/OpenAlchemy/releases/v2.3.0 [v2.4.2]: https://github.com/jdkandersson/OpenAlchemy/releases/v2.4.2 [v2.5.0]: https://github.com/jdkandersson/OpenAlchemy/releases/v2.5.0 [///]: # "Issue/PR links" [#189]: https://github.com/jdkandersson/OpenAlchemy/issues/189 [#190]: https://github.com/jdkandersson/OpenAlchemy/issues/190 [#196]: https://github.com/jdkandersson/OpenAlchemy/issues/196 [#198]: https://github.com/jdkandersson/OpenAlchemy/issues/198 [#201]: https://github.com/jdkandersson/OpenAlchemy/issues/201 [#202]: https://github.com/jdkandersson/OpenAlchemy/issues/202 [#236]: https://github.com/jdkandersson/OpenAlchemy/issues/236 [#251]: https://github.com/jdkandersson/OpenAlchemy/issues/251 [#255]: https://github.com/jdkandersson/OpenAlchemy/issues/255 [#276]: https://github.com/jdkandersson/OpenAlchemy/issues/276 [#294]: https://github.com/jdkandersson/OpenAlchemy/issues/294