Schema not generated for types exported from module
See original GitHub issueHi,
I’m finding that types exported from an external module do not have schemas generated for them. I have a types library @stemn/types
and a schemas library @stemn/schemas
.
My intention was to generate my schemas from my types library by exporting my types as so
// schemas.ts
export { IPipelineYmlV1 } from '@stemn/types';
Running
yarn typescript-json-schema schemas.ts IPipelineYmlV1
produces
Error: type IPipelineYmlV1 not found
at JsonSchemaGenerator.getSchemaForSymbol (/node_modules/typescript-json-schema/typescript-json-schema.js:764:19)
Further testing showed when an imported type is extended its properties do not show in the produced schema. For example
// schemas.ts
import { IPipelineYmlV1 } from '@stemn/types';
export interface IPipelineYmlV2 extends IPipelineYmlV1 {
child: boolean;
}
run with
yarn typescript-json-schema schemas.ts '*'
produces
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"IPipelineYmlV2": {
"properties": {
"child": {
"type": "boolean"
}
},
"type": "object"
}
}
}
Is this expected functionality? If so, is there something I can do to have schemas generated for a directly exported type? Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
An issue with Nestjs mongoose module after installation
d.ts:2:44 - error TS2694: Namespace '"mongoose"' has no exported member 'SchemaTypeOpts'. export declare type PropOptions = mongoose.
Read more >ytt - Export Schema in OpenAPI Format - Carvel tools
Working Example · Exported Properties. title; type; additionalProperties; nullable; deprecated; description; x-example-description; example; default · Known ...
Read more >Generating client types in Pothos GraphQL
The first thing you will need is a file that exports your built schema. The schema should be exported as schema or as...
Read more >makeSchema - GraphQL Nexus
2import * as types from './allNexusTypes'. 3. 4export const schema = makeSchema({. 5 types, ... If you do not wish to generate one...
Read more >schema field - GraphQL Code Generator
exports = buildSchema(/* GraphQL */ ` type MyType { foo: String! } type Query { myType: MyType! } `).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Interesting. I wonder whether https://github.com/vega/ts-json-schema-generator picks up external types more cleanly.
I created a minimum viable
tsconfig.json
that includes all files - no luck.