Skip to content
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

Fix OpenAPI generation #2664

Merged
merged 1 commit into from
Jul 1, 2024
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
Binary file modified compiler-rs/compiler-wasm-lib/pkg/compiler_wasm_lib_bg.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions compiler/src/model/metamodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class Container extends VariantBase {

export class Untagged extends VariantBase {
kind: 'untagged'
untypedVariant: Inherits
untypedVariant: TypeName
}

/**
Expand All @@ -223,7 +223,7 @@ export class Inherits {
export class Behavior {
type: TypeName
generics?: ValueOf[]
meta?: { [p: string]: string }
meta?: Record<string, string>
}

/**
Expand Down
6 changes: 2 additions & 4 deletions compiler/src/model/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1129,10 +1129,8 @@ export function parseVariantsTag (jsDoc: JSDoc[]): model.Variants | undefined {
kind: 'untagged',
nonExhaustive: nonExhaustive,
untypedVariant: {
type: {
namespace: fqn.slice(0, fqn.length - 1).join('.'),
name: fqn[fqn.length - 1]
}
namespace: fqn.slice(0, fqn.length - 1).join('.'),
name: fqn[fqn.length - 1]
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/steps/validate-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
throw new Error(`Please contact the devtools team before adding new untagged variant ${fqn(parentName)}`)
}

const untypedVariant = getTypeDef(variants.untypedVariant.type)
const untypedVariant = getTypeDef(variants.untypedVariant)
if (untypedVariant == null) {
modelError(`Type ${fqn(variants.untypedVariant.type)} not found`)
modelError(`Type ${fqn(variants.untypedVariant)} not found`)
}

const items = flattenUnionMembers(valueOf)
Expand Down
18 changes: 6 additions & 12 deletions output/schema/schema.json

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

29 changes: 21 additions & 8 deletions output/typescript/types.ts

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

4 changes: 2 additions & 2 deletions typescript-generator/src/metamodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class Container extends VariantBase {

export class Untagged extends VariantBase {
kind: 'untagged'
untypedVariant: Inherits
untypedVariant: TypeName
}

/**
Expand All @@ -223,7 +223,7 @@ export class Inherits {
export class Behavior {
type: TypeName
generics?: ValueOf[]
meta?: { [p: string]: string }
meta?: Record<string, string>
}

/**
Expand Down
Loading