All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Nothing yet.
-
Breaking: Snake case normalization (ex. function names) now correctly segments numbers. For example, an operation
v2example
is now output asv2_example
. This may be a breaking change for clients with numbers in operation IDs. -
Add: New configuration option
naming.field_casing
to choose between:camel
case,:snake
case, or performing no normalization (nil
, the default). Using this option may be necessary for API descriptions that include non-normalized field names (for example, fields that begin with a number or symbol). Setting this configuration would be a breaking change for any clients based on API descriptions that have inconsistent field casing. -
Fix: Parameters listed in path items (as opposed to operations) now support refs.
-
Fix: References that point to references are now handled correctly.
- Fix: Allow HTTP response codes encoded as integer keys instead of string keys.
This release is a major change from version 0.0.8
.
It includes support for plugins, sub-schemas, and more.
See the plugins guide and migration guide for more information, and check out the release candidate notes below for a comprehensive list of changes.
Changes since the last release candidate:
- Fix:
anyOf
andoneOf
definitions now take precedence over generic union types. - Fix: Modules with both schema(s) and operations no longer define
__field__/1
twice. - Fix: Add URL encoded form types to the readable type helper, and fix its fallback clause.
- Fix: Warn about unknown types (for example, null schemas) instead of raising.
- Fix: Avoid outputting empty schemas that have no properties but accept arbitrary additional properties.
-
Breaking: Output schemas that represent subfields of an already-output schema.
-
Add: Output full structs for any schemas in the
responses
component portion of the spec. -
Add: New plugin callback
c:OpenAPI.Processor.schema_format/2
to set the output format of a schema (ex.:struct
or:typed_map
). -
Add: Support schemas that utilize
allOf
with a naive intersection type. -
Add: New configuration option
output.operation_call.request
to modify the format of output request information in the operation function call. Use:map
to output it as a map instead of a list of tuples. -
Fix: Avoid outputting empty files.
-
Fix: Avoid accidentally unwrapping array types in operation typespecs.
-
Fix: Support API descriptions that have a discriminator without a
mapping
key (thanks @s3cur3!).
- Fix: Cyclical schema references would result in an infinite loop during the read phase. This has been fixed specifically for schema references; if references that don't point to schemas create a cycle, generation will still fail.
- Fix: Schemas that only appeared in union types were not properly processed, resulting in more plain
map
types than intended.
- Fix: Schema output was non-deterministic due to map ordering and an issue tracking contexts.
- Fix: Warn when an enum type is invalid (ex. contains schemas).
In this case, the type will be expanded to
:any
but otherwise continue processing. - Fix: Map types were output as the literal atom
:map
instead ofmap
in typespecs. - Fix: Preserve indentation of operation docstrings.
- Fix: Always include
args
in client calls, even if the list is empty. - Fix: Ensure the app is started in
mix api.gen
. This resolves an issue in which configured processor or renderer modules may not be available.
- Breaking: This is a major release. See the migration guide for more information.
- Add: Plugin system for overriding the behavior of this library. See the plugins guide for more information.
- Add: Additional internal types to represent string variations, enums, etc.
- Fix: Uniformly normalize names of operations and schemas.
- Fix: Path parameters are now collected from more locations in the spec. Previously, the generator only noticed path parameters declared in the individual path items. This may cause breaking changes in some operation functions, however they were likely unusable before.
- Fix: Ensure all path parameter keys are properly underscored (thanks wingyplus!).
- Add:
schema_use
option to add optionaluse [Module]
statements within schemas. - Add:
operation_default_module
andoperation_use_tags
options for controlling the creation of operation modules (thanks @xadhoom!). - Add: New Client Author Guide for assisting client library authors.
- Fix: Allow empty/missing
tags
andcomponents
keys in the specification (thanks @rubas!). - Fix: Allow missing server variable object in the specification (thanks @xadhoom!).
- Fix: Keep acronyms intact when naming operations (thanks @feynmanliang!).
- Add: New
extra_fields
option to allow library authors to create their own private fields on generated structs. The location and semantics of this option are likely to be changed in the future. - Fix: Include
body
argument inargs
passed to the client. Clients may rely on this information (the values themselves, or the arity) for their operations, especially in testing situations.
- Fix: Replace all non-alphanumeric characters when naming tagged operations.
- Fix: Handle nullable union types with no realizable non-null types. This case occurred in the GitHub spec (see github/rest-api-description#2534).
- Add: Add
call
information to client calls. This will allow specialized clients, like a test mock, to introspect the original calling function without the use of stack traces. - Fix: Add missing type
:map
toOpenAPI.Generator.Typing.t()
. - Fix: Support
default
entry in responses object (thanks @aej!). - Fix: Strip spaces and repetitive dash/underscore/whitespace characters when naming operations (thanks @feynmanliang!).
- Add: Add
args
keyword list to client calls. This will allow specialized clients, like a test mock, to differentiate between static URL segments and dynamic path parameters.
- Add: Support OpenAPI 3.1
"null"
type - Add: Support
type
field given as an array of primitive types - Fix: Infer
map
type in more cases whentype
field is unspecified
- Initial Release