typescript
typescript copied to clipboard
Single exported `AWS` definition instead of multiple definitions
Use case description
With the resolution of #4, the introduction of a custom normalizer changing const
to single-value enum
prevented json-schema-to-ts to resolve each JSON-Schema definition as a separate exported type.
The option declareExternallyReferenced
, described in https://github.com/bcherny/json-schema-to-typescript#options, is still at its current true
default value, but looks ineffective
Proposed solution
Setting unreachableDefinitions
to true
should declare those definitions but not use them in the actual AWS
exported main type.
In case somebody experiences this issue, one way to reduce this issue in the mean time is to use subdefinition like this :
import type { AWS } from '@serverless/typescript';
const HttpApiAuthorizer: AWS['resources']['Resources']['value'] = {
Type: 'AWS::ApiGatewayV2::Authorizer',
Properties: {
Name: 'HttpApiAuthorizer',
//...
};
#10 managed to export all definitions referenced in JSON schema. But this does not include CFN resource, which is not defined as a $ref
. First experimentations with quicktype - #1 - shows that all definitions are much more broken down. Will check again once PR is merged and new definition is released for this issue.