Skip to content

Conversation

dev-geddy
Copy link

No description provided.

Copy link

changeset-bot bot commented Aug 26, 2025

🦋 Changeset detected

Latest commit: 33086d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
swagger-typescript-api Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@smorimoto

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@dev-geddy dev-geddy force-pushed the feat/add-jsonld-schema-support branch from 6de32e5 to 2c0e0b7 Compare September 3, 2025 20:04
@smorimoto

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@smorimoto
Copy link
Collaborator

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

this.templatesWorker = schemaParser.templatesWorker;
}
base = {
[SCHEMA_TYPES.ENUM]: (parsedSchema) => {
if (this.config.generateUnionEnums) {
return {
...parsedSchema,
$content: parsedSchema.content,
content: this.config.Ts.UnionType(
parsedSchema.content.map(({ value }) => value),
),
};
}
return {
...parsedSchema,
$content: parsedSchema.content,
content: this.config.Ts.EnumFieldsWrapper(parsedSchema.content),
};
},
[SCHEMA_TYPES.OBJECT]: (parsedSchema) => {
if (parsedSchema.nullable)
return this.inline[SCHEMA_TYPES.OBJECT](parsedSchema);
return {
...parsedSchema,
$content: parsedSchema.content,
content: this.formatObjectContent(parsedSchema.content),
};
},
[SCHEMA_TYPES.PRIMITIVE]: (parsedSchema) => {
return {
...parsedSchema,

[P1] Add formatter branches for JSON-LD schema types

The commit introduces three new schema types (JSONLD_CONTEXT, JSONLD_ENTITY, JSONLD_TYPE), but SchemaFormatters still formats only enums, objects and primitives. When a JSON-LD schema is parsed, formatSchema falls through and returns the raw array of field descriptors. Templates render that array with JavaScript’s default stringification (e.g. [object Object]) so the generated interfaces don’t contain any of the actual properties. This can be seen in the new snapshots where every field prints [object Object]. The formatter needs explicit entries (or reuse the object formatter) for the JSON-LD schema types to emit valid TypeScript.


)),
);
}
if (generateClient) {
const apiModuleContent = this.templatesWorker.renderTemplate(
templatesToRender.api,
{
...configuration,
route,
},
);
modularApiFileInfos.push(
...(await this.createOutputFileInfo(
configuration,
pascalCase(route.moduleName),
apiModuleContent,
)),
);
}
}
}
return [
...(await this.createOutputFileInfo(
configuration,
fileNames.dataContracts,
this.templatesWorker.renderTemplate(
templatesToRender.dataContracts,
configuration,
),
)),
...(generateClient
? await this.createOutputFileInfo(
configuration,
fileNames.httpClient,
this.templatesWorker.renderTemplate(
templatesToRender.httpClient,
configuration,
),
)
: []),
...modularApiFileInfos,

[P2] Render JSON-LD templates when generating data contracts

Configuration now declares jsonldContextDataContract, jsonldEntityDataContract, and jsonldUtils templates, but the generation pipeline never renders them. CodeGenProcess.createModularFileInfo and createSingleFileInfo still only render templatesToRender.dataContracts, routeTypes, httpClient, and api; nothing consults jsonLdOptions.generateContext/generateUtils. As a result the new templates and options have no effect—no JSON-LD specific interfaces or utilities are emitted regardless of configuration. Hooking these templates into the output (e.g. when JSON-LD schemas are present) is required for the feature to work.


Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

@smorimoto smorimoto added the enhancement New feature or request label Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants