EventBridge Typescript code bindings are not accurate

0

I'm trying to use EventBridge Typescript code bindings but it seems that they're not 100% accurate given the schema I've defined. This is a bit of a bummer for me, as I'll probably need to find another codegen tool to replace it (which I've tried, but found some other issues).

It seems that it doesn't take into considerations things like optional properties, or enums. Here's an example:

OpenAPI schema example: { "components": { "schemas": { "Event": { "properties": { "actor": { "enum": ["internal", "system"], "type": "string" }, "score": { "type": "number" }, "userId": { "type": "string" } }, "type": "object", "required": ["userId"] } } }, "info": { "title": "Event", "version": "2.1.1" }, "openapi": "3.0.0", "paths": {} }

What do I get: export class Event { 'actor': string; 'score': number; 'userId': string;

What I expect: export class Event { 'actor'?: 'internal' | 'system'; 'score'?: number; 'userId': string;

Would be nice to understand if this is the expected behaviour or if I'm missing something.

Thank you!

asked 9 months ago100 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions