json-schema-to-typescript icon indicating copy to clipboard operation
json-schema-to-typescript copied to clipboard

Invalid output for empty json schema

Open mrtnlrsn opened this issue 4 years ago • 1 comments

Both the following schemas

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Empty",
  "type": "object",
  "additionalProperties": false
}
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Empty",
  "type": "object",
  "additionalProperties": false,
  "properties": {
  }
}

results in the following output

/* tslint:disable */
/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */

export type Empty = {

Note, the missing end-curly-parenthesis

mrtnlrsn avatar Mar 12 '21 13:03 mrtnlrsn

@mrtnlrsn I ran the two provided schemas through the version 10.1.4 cli and received the following for both.

/* tslint:disable */
/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */

export interface Empty {}

Can you confirm the problem is still occurring in 10.1.4?

ericArbour avatar Apr 04 '21 20:04 ericArbour