New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@json-schema-tools/transpiler

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@json-schema-tools/transpiler - npm Package Compare versions

Comparing version 1.4.3 to 1.5.0

1

build/codegens/codegen.d.ts

@@ -7,2 +7,3 @@ import { JSONSchema, JSONSchemaObject, JSONSchemaBoolean } from "@json-schema-tools/meta-schema";

documentationComment?: string;
imports?: string[];
}

@@ -9,0 +10,0 @@ /**

@@ -28,2 +28,3 @@ "use strict";

}
var imports = new Set();
var rootSchemaTypes = "";

@@ -34,2 +35,5 @@ if (this.schema.$ref === undefined) {

rootSchemaTypes = this.generate(this.schema, ir);
if (ir.imports) {
ir.imports.forEach(function (imp) { return imports.add(imp); });
}
if (this.schema.$ref) { // hack

@@ -50,2 +54,5 @@ delete this.schema.$ref; // hack

var ir = _this.toIR(schema);
if (ir.imports) {
ir.imports.forEach(function (imp) { return imports.add(imp); });
}
if (schema === true || schema === false) {

@@ -58,3 +65,3 @@ defsSchemaTypes.push(ir.typing);

}
return __spreadArrays(defsSchemaTypes, [
return __spreadArrays(Array.from(imports), defsSchemaTypes, [
rootSchemaTypes,

@@ -61,0 +68,0 @@ ]).join("\n").trim();

@@ -163,3 +163,3 @@ "use strict";

"func (o " + typeTitle + ") MarshalJSON() ([]byte, error) {",
"\t" + "out := []interface{}",
"\t" + "out := []interface{}{}",
components.map(function (c) { return c.map(function (cl) { return "\t" + cl; }).join("\n"); }).join("\n"),

@@ -226,2 +226,6 @@ "\t" + "return json.Marshal(out)",

documentationComment: this.buildDocs(s),
imports: [
"import \"encoding/json\"",
"import \"errors\""
]
};

@@ -259,2 +263,6 @@ };

documentationComment: this.buildDocs(s),
imports: [
"import \"encoding/json\"",
"import \"errors\""
]
};

@@ -261,0 +269,0 @@ };

66

build/codegens/python.js

@@ -31,4 +31,2 @@ "use strict";

return [
ir.macros,
"\n",
ir.documentationComment,

@@ -43,4 +41,4 @@ "\n",

documentationComment: this.buildDocs(s),
macros: "from typing import NewType",
typing: title + " = NewType(\"" + title + "\", bool)",
imports: ["from typing import NewType"],
};

@@ -52,4 +50,4 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import NewType",
typing: title + " = NewType(\"" + title + "\", None)",
imports: ["from typing import NewType"]
};

@@ -61,4 +59,4 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import NewType",
typing: title + " = NewType(\"" + title + "\", float)",
imports: ["from typing import NewType"]
};

@@ -70,4 +68,4 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import NewType",
typing: title + " = NewType(\"" + title + "\", int)",
imports: ["from typing import NewType"]
};

@@ -88,4 +86,4 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import NewType",
typing: title + " = NewType(\"" + title + "\", str)",
imports: ["from typing import NewType"]
};

@@ -100,3 +98,2 @@ };

return {
macros: "from enum import Enum",
documentationComment: this.buildDocs(s),

@@ -106,2 +103,3 @@ typing: __spreadArrays([

], typeLines).join("\n"),
imports: ["from enum import Enum"]
};

@@ -115,5 +113,8 @@ };

return {
macros: "from typing import NewType, Tuple",
documentationComment: this.buildDocs(s),
typing: title + " = NewType(\"" + title + "\", Tuple[" + itemTitles.join(", ") + "])",
imports: [
"from typing import NewType",
"from typing import Tuple"
]
};

@@ -126,4 +127,7 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import List, NewType",
typing: title + " = NewType(\"" + title + "\", List[" + itemsTitle + "])",
imports: [
"from typing import List",
"from typing import NewType"
]
};

@@ -135,4 +139,8 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import List, Any, NewType",
typing: title + " = NewType(\"" + title + "\", List[Any])",
imports: [
"from typing import List",
"from typing import Any",
"from typing import NewType"
]
};

@@ -162,6 +170,9 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import TypedDict, Optional",
typing: __spreadArrays([
"class " + title + "(TypedDict):"
], propertyTypings).join("\n"),
imports: [
"from typing import TypedDict",
"from typing import Optional"
]
};

@@ -173,4 +184,8 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import NewType, Any, Mapping",
typing: title + " = NewType(\"" + title + "\", Mapping[Any, Any])",
imports: [
"from typing import NewType",
"from typing import Any",
"from typing import Mapping"
]
};

@@ -182,6 +197,9 @@ };

return {
macros: "from typing import NewType, Union",
documentationComment: this.buildDocs(s),
prefix: "type",
typing: title + " = NewType(\"" + title + "\", Union[" + this.getJoinedSafeTitles(sAny, ", ") + "])",
imports: [
"from typing import NewType",
"from typing import Union"
]
};

@@ -207,6 +225,9 @@ };

return {
macros: "from typing import NewType, Union",
documentationComment: this.buildDocs(s),
prefix: "type",
typing: title + " = NewType(\"" + title + "\", Union[" + this.getJoinedSafeTitles(sOne, ", ") + "])",
imports: [
"from typing import NewType",
"from typing import Union"
]
};

@@ -217,7 +238,7 @@ };

return {
typing: [
"from typing import Any, NewType",
"",
t + " = NewType(\"" + t + "\", Any)",
].join("\n"),
typing: t + " = NewType(\"" + t + "\", Any)",
imports: [
"from typing import NewType",
"from typing import Any"
]
};

@@ -229,4 +250,7 @@ };

documentationComment: this.buildDocs(s),
macros: "from typing import Any, NewType",
typing: title + " = NewType(\"" + title + "\", Any)",
imports: [
"from typing import NewType",
"from typing import Any"
]
};

@@ -233,0 +257,0 @@ };

@@ -0,1 +1,15 @@

# [1.5.0](https://github.com/json-schema-tools/transpiler/compare/1.4.3...1.5.0) (2020-10-09)
### Bug Fixes
* get it all working ([7e10cbf](https://github.com/json-schema-tools/transpiler/commit/7e10cbff62765ad5b9ee661307ac295cc5cd71af))
* interface was incorrect ([8a55496](https://github.com/json-schema-tools/transpiler/commit/8a55496547e671b24747dc73fce00a5ae25d59af))
* update node version ([c2374f4](https://github.com/json-schema-tools/transpiler/commit/c2374f4f5eb7b8752fab6c7ebc3e01e890264cc5))
### Features
* implement imports as part of IR ([9f7ba6b](https://github.com/json-schema-tools/transpiler/commit/9f7ba6bfd07f70f4044279cf65cdd8274408b84b))
## [1.4.3](https://github.com/json-schema-tools/transpiler/compare/1.4.2...1.4.3) (2020-10-08)

@@ -2,0 +16,0 @@

{
"name": "@json-schema-tools/transpiler",
"version": "1.4.3",
"version": "1.5.0",
"description": "Turn your json schema into typings for various languages. Achieve master class dev tooling.",

@@ -5,0 +5,0 @@ "main": "build/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc