mnahkies / mnahkies/openapi-code-generator
Issue I am having with 'additionalProperties' and TypeSpec
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 34
- Forks
- 8
- Avg merge
- 20h 27m
- Merged PRs (30d)
- 7
Description
Hi there,
So I recently found out about https://typespec.io/ and was interested in giving it ago, and so far has been pretty interesting as well as a nice difference to writing it in yaml.
However I just found my first problem since using it, and that is that they don't allow you a way to generate additionalProperties with a yes meaning I am currently unable to use my APIError object as I previously was, and that is due to the EmptyObject that is applied, which essentially forces me to do as any every time I wish to output any metadata.
export type t_APIError = {
error: string
message?: string
metadata?: {
[key: string]: EmptyObject
}
suggested?: string
}
Is there a way to nicely work around this or will I need to wait for some update/change for it? For now I will just override the type checking with as any until a better solution is found.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test is named. Start by tracing how the t_APIError example and its metadata additionalProperties are represented in generated TypeScript, especially where EmptyObject is introduced; done means generated metadata accepts arbitrary values without requiring as any, with a regression test if the project has a relevant test entry point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- backend-api-design, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100