Skip to content

Commit 4c460cc

Browse files
committed
Fix OpenAPI generation
1 parent 3f5c846 commit 4c460cc

File tree

7 files changed

+35
-30
lines changed

7 files changed

+35
-30
lines changed
Binary file not shown.

compiler/src/model/metamodel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export class Container extends VariantBase {
209209

210210
export class Untagged extends VariantBase {
211211
kind: 'untagged'
212-
untypedVariant: Inherits
212+
untypedVariant: TypeName
213213
}
214214

215215
/**
@@ -223,7 +223,7 @@ export class Inherits {
223223
export class Behavior {
224224
type: TypeName
225225
generics?: ValueOf[]
226-
meta?: { [p: string]: string }
226+
meta?: Record<string, string>
227227
}
228228

229229
/**

compiler/src/model/utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,10 +1129,8 @@ export function parseVariantsTag (jsDoc: JSDoc[]): model.Variants | undefined {
11291129
kind: 'untagged',
11301130
nonExhaustive: nonExhaustive,
11311131
untypedVariant: {
1132-
type: {
1133-
namespace: fqn.slice(0, fqn.length - 1).join('.'),
1134-
name: fqn[fqn.length - 1]
1135-
}
1132+
namespace: fqn.slice(0, fqn.length - 1).join('.'),
1133+
name: fqn[fqn.length - 1]
11361134
}
11371135
}
11381136
}

compiler/src/steps/validate-model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,9 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
617617
throw new Error(`Please contact the devtools team before adding new untagged variant ${fqn(parentName)}`)
618618
}
619619

620-
const untypedVariant = getTypeDef(variants.untypedVariant.type)
620+
const untypedVariant = getTypeDef(variants.untypedVariant)
621621
if (untypedVariant == null) {
622-
modelError(`Type ${fqn(variants.untypedVariant.type)} not found`)
622+
modelError(`Type ${fqn(variants.untypedVariant)} not found`)
623623
}
624624

625625
const items = flattenUnionMembers(valueOf)

output/schema/schema.json

Lines changed: 6 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 21 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typescript-generator/src/metamodel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export class Container extends VariantBase {
209209

210210
export class Untagged extends VariantBase {
211211
kind: 'untagged'
212-
untypedVariant: Inherits
212+
untypedVariant: TypeName
213213
}
214214

215215
/**
@@ -223,7 +223,7 @@ export class Inherits {
223223
export class Behavior {
224224
type: TypeName
225225
generics?: ValueOf[]
226-
meta?: { [p: string]: string }
226+
meta?: Record<string, string>
227227
}
228228

229229
/**

0 commit comments

Comments
 (0)