You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OpenAPI spec I'm working with has pattern, nullable, and format attributes all over the place, and these are not turned into JSDOC tags.
Other tools, like @openapi-codegen/cli, support these tags.
JSDOC tags are used by other tools like ts-to-zod and @savotije/openapi-to-joi, each of which generate schema validation code from TYpeScript source. Both of those recognize @pattern, @nullable and @format tags.
Proposal
I don't really understand the code, but I found some simple changes in addJSDocComment would suffice.
First, I added a pattern field in AnnotatedSchemaObject:
exportinterfaceAnnotatedSchemaObject{const?: unknown;// jsdoc without valuedefault?: unknown;// jsdoc with valuedeprecated?: boolean;// jsdoc without valuedescription?: string;// jsdoc with valueenum?: unknown[];// jsdoc without valueexample?: string;// jsdoc with valueformat?: string;// not jsdocpattern?: string;// not jsdocnullable?: boolean;// Node informationsummary?: string;// not jsdoctitle?: string;// not jsdoctype?: string|string[];// Type of node}
Then, I commented out the test for schemaObject.format.
Description
The OpenAPI spec I'm working with has
pattern
,nullable
, andformat
attributes all over the place, and these are not turned into JSDOC tags.Other tools, like
@openapi-codegen/cli
, support these tags.JSDOC tags are used by other tools like
ts-to-zod
and@savotije/openapi-to-joi
, each of which generate schema validation code from TYpeScript source. Both of those recognize@pattern
,@nullable
and@format
tags.Proposal
I don't really understand the code, but I found some simple changes in
addJSDocComment
would suffice.First, I added a
pattern
field inAnnotatedSchemaObject
:Then, I commented out the test for
schemaObject.format
.Then, I changed
supportedJsDocTags
to this:Finally, I added the following:
These changes supported the tags I mentioned, and generated JSDoc tags that look correct to me.
Checklist
The text was updated successfully, but these errors were encountered: