Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions codegen/lib/build-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,17 +646,24 @@ const resolveModel = (

// The C# type for an endpoint's return value, and the resource property name it
// is unwrapped from in the response body.
// A model named like the API class that returns it (e.g. Media from the Media
// API) is shadowed by that class inside Seam.Api, so it is fully qualified.
const responseReturn = (
response: Endpoint['response'],
modelTypes: Set<string>,
apiClassName: string,
): { returnType: string; returnProp: string } | undefined => {
if (response.responseType === 'void') return undefined
const returnProp = pascalCase(response.responseKey)
const model = resolveModel(
const resolvedModel = resolveModel(
response.resourceType,
response.responseKey,
modelTypes,
)
const model =
resolvedModel === apiClassName
? `Seam.Model.${resolvedModel}`
: resolvedModel
const returnType =
response.responseType === 'resource_list' ? `List<${model}>` : model
return { returnType, returnProp }
Expand Down Expand Up @@ -690,7 +697,11 @@ export const buildApiFile = (
: {}),
}

const returned = responseReturn(endpoint.response, modelTypes)
const returned = responseReturn(
endpoint.response,
modelTypes,
pascalCase(className),
)
const isVoid = returned == null

if (isVoid) {
Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
},
"packageManager": "npm@11.19.0",
"devDependencies": {
"@seamapi/blueprint": "^1.9.1",
"@seamapi/blueprint": "^1.12.0",
"@seamapi/smith": "^1.1.0",
"@seamapi/types": "1.1047.0",
"@seamapi/types": "1.1092.0",
"change-case": "^5.4.4",
"execa": "^10.0.1",
"prettier": "^3.0.0"
Expand Down
138 changes: 69 additions & 69 deletions src/Seam/Api/AccessCodes.cs

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions src/Seam/Api/AccessGrants.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading