-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
v4.7.0 broke code generation #419
Labels
Comments
Narrowed it down to the filtering done here in generate.ts (line 741). /**
* Recursively creates a type literal with the given props.
*/
getTypeFromProperties(
props: {
[prop: string]: SchemaObject | OpenAPIV3.ReferenceObject;
},
required?: string[],
additionalProperties?:
| boolean
| OpenAPIV3.SchemaObject
| OpenAPIV3.ReferenceObject,
onlyMode?: OnlyMode
): ts.TypeLiteralNode {
const members: ts.TypeElement[] = Object.keys(props)
.filter((name) => {
const schema = props[name];
if (!onlyMode)
return (
!this.isSchemaReadOnly(schema) && !this.isSchemaWriteOnly(schema)
);
if (onlyMode === "readOnly") return this.isSchemaReadOnly(schema);
else if (onlyMode === "writeOnly")
return this.isSchemaWriteOnly(schema);
})
.map((name) => {
const schema = props[name];
const isRequired = required && required.includes(name);
let type = this.getTypeFromSchema(schema, name);
if (!isRequired && this.opts.unionUndefined) {
type = factory.createUnionTypeNode([type, cg.keywordType.undefined]);
}
return cg.createPropertySignature({
questionToken: !isRequired,
name,
type,
});
}); |
Merged
🎉 This issue has been resolved in version 4.7.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi guys,
Mea culpa, my PR broke code generation, the tests didn't catch this.
@Xiphe I suggest rolling back to
v4.6.0
. In the meantime, I will try to fix this and add a PR with a test.Given this endpoint definition
The response's schema should be:
Before v4.7.0, oazapfts generated
Whereas now, it doesn't type the response
The text was updated successfully, but these errors were encountered: