Repository navigation
v0.10.0
Minor Changes
-
With
extends, the relative paths in a base config (output,files.entry,files.tsconfig,files.dtoGlob, andoptions.overlaygiven as a path) now resolve against the folder of the base config, as tsconfigextendsdoes. Before, they resolved against the folder of the config you passed. This only affects setups whose base config is in a different folder and uses relative paths; move those paths so they are relative to the base file. Paths a child config sets itself are unchanged. -
Generated documents now keep declaration order: paths follow the controllers as they are reached from the entry module, operations and properties follow the class, and component schemas follow the order they are first reached. Before, all of them were sorted A to Z. Set
options.order: 'alphabetical'to restore the old order. Only key order changes, not values. Expected documents under test/contract change in key order only. -
Removed exports nothing in the docs used. Use the plain function with the same name instead. Services:
ProjectService,ProjectServiceLive,ModuleTraversalService,MethodExtractionService,TransformerService,SchemaService,ValidationMapperService,ValidationService. Effect copies of pure functions:getMethodInfoEffect,getControllerMethodInfosEffect,transformMethodEffect,transformMethodsEffect,mergeSchemasEffect,mergeGeneratedSchemasEffect,filterSchemasEffect,normalizeSchemasEffect,filterInternalSchemasEffect,normalizeStructureRefsEffect,mergeValidationConstraintsEffect. Helpers:mergeGeneratedSchemas,filterSchemas,normalizeSchemas,filterInternalSchemas,NormalizerOptions,extractClassConstraints(useextractClassValidationInfo(...).constraints),getRequiredProperties(useextractClassValidationInfo(...).required),getHttpMethods,isHttpDecorator,getStringLiteralValue. Duplicates ofgenerate:generateFromConfigEffect,generateFromConfigAsync.generatorServicesLayernow provides onlyConfigServiceandOutputService. Generated documents are unchanged.
Patch Changes
-
OpenAPI 3.1 and 3.2 output now writes the nullable values of maps (
Record<string, T | null>), and schemas undernotandpatternProperties, in 3.1 form instead of leaving the 3.0-onlynullable. Alias collapsing also rewrites refs undernot,patternPropertiesand discriminatormapping. Expected documents changed: test/contract/schemas/contracts/record-nullable-values.{3.1.0,3.2.0}.json and nested-subschemas.{3.1.0,3.2.0}.json. -
A generic return type whose argument is written through a namespace import (
Page<Dtos.UserDto>) now gets its schema, instead of a$refto a component that was never generated. -
An enum member, a union of enum members, and
RecordorPartial<Record>keyed by an enum now keep their values when used directly as a parameter, body or return type. A union of members is an enum of those values, a single member is a single value (constfrom 3.1), and an enum-keyed record lists one property per enum value, required unless wrapped inPartial. Before, they came out astype: objector aoneOfof objects. Plain string or number literal unions used directly in operation parameters, bodies and return types are now written as anenuminstead of aoneOfof objects. -
OpenAPI 3.0 output (the default) now writes
string | numberproperties asanyOfinstead of an invalid type list, and drops scopes from security requirements on non-OAuth schemes with a warning. Nullable enums now allownullin every version. Tuples keep their element types:prefixItemsin 3.1 and 3.2, and in 3.0 oneitemsanyOfof the position types, which is lossy because 3.0 cannot say which position holds which type (minItemsandmaxItemsstill keep the length). Expected documents changed: primitive-union.3.0.3.json, nullable-enum.{3.0.3,3.1.0,3.2.0}.json, tuple.{3.0.3,3.1.0,3.2.0}.json, and new api-key-scopes.{3.0.3,3.1.0,3.2.0}.json under test/contract. -
A parameter, body or return type that uses an enum from a library, such as
HttpStatusfrom@nestjs/common, now produces its schema. Before, the$refpointed at a schema that was never written, so validation failed whenever the enum appeared only outside the DTO files. -
A module that lists its controllers or imports through a spread or an identifier, such as
controllers: [...controllers]withcontrollersan array declared locally or imported, now has them discovered, instead of yielding no operations. Entries computed at runtime are skipped.