glideapps / glideapps/quicktype

Bug: allow muliple json schema files as input

Open
#1,910 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
13.9k
Forks
1.2k
Avg merge
8h 53m
Merged PRs (30d)
369

Description

Hi, the following input creates unexpected output:
` quicktype --src-lang schema /schemas/ -o Models.ts`

Example:
suppose the file /schemas/alert_schema.json:
```
{
"type": "object",
"required": [
"issue_id",
"alert_type_id",
"options"
],
"properties": {
"issue_id": {
"type": "string",
"format": "uuid"
},
"alert_type_id": {
"type": "string",
"format": "uuid"
},
"options": {
"type": "object"
}
},
"additionalProperites": false
}
```
actual content of Models.ts:
```
export interface AlertSchema {
type: Type;
required: string[];
properties: AlertSchemaProperties;
additionalProperites: boolean;
}

export interface AlertSchemaProperties {
issue_id: AlertTypeID;
alert_type_id: AlertTypeID;
options: Options;
}

export interface AlertTypeID {
type: Type;
format: Format;
}

export enum Format {
DateTime = "date-time",
UUID = "uuid",
}

export enum Type {
Boolean = "boolean",
Integer = "integer",
Number = "number",
Object = "object",
String = "string",
}

export interface Options {
type: Type;
}
```

expected content of Models.ts:
```
export interface AlertSchema {
alert_type_id: string;
issue_id: string;
options: { [key: string]: any };
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.