@tim-smart/openapi-gen 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/main.js +4 -5
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -34825,9 +34825,10 @@ var make64 = gen2(function* () {
34825
34825
  const refStore = /* @__PURE__ */ new Map();
34826
34826
  function cleanupSchema(schema) {
34827
34827
  if ("type" in schema && Array.isArray(schema.type) && schema.type.includes("null")) {
34828
+ const type2 = schema.type.filter((_) => _ !== "null");
34828
34829
  schema = {
34829
34830
  ...schema,
34830
- type: schema.type.filter((_) => _ !== "null"),
34831
+ type: type2.length === 1 ? type2[0] : type2,
34831
34832
  nullable: true
34832
34833
  };
34833
34834
  }
@@ -34949,7 +34950,7 @@ var make64 = gen2(function* () {
34949
34950
  if ("$ref" in raw) {
34950
34951
  return refStore.get(raw.$ref) ?? raw;
34951
34952
  }
34952
- return raw;
34953
+ return cleanupSchema(raw);
34953
34954
  };
34954
34955
  const flattenAllOf = (schema) => {
34955
34956
  if ("allOf" in schema) {
@@ -34968,9 +34969,6 @@ var make64 = gen2(function* () {
34968
34969
  const transformer = yield* JsonSchemaTransformer;
34969
34970
  const toSource = (importName, schema, currentIdentifier, topLevel = false) => {
34970
34971
  schema = cleanupSchema(schema);
34971
- if (currentIdentifier.startsWith("FunctionCall")) {
34972
- console.error(schema, currentIdentifier);
34973
- }
34974
34972
  if ("properties" in schema) {
34975
34973
  const obj = schema;
34976
34974
  const required2 = obj.required ?? [];
@@ -34978,6 +34976,7 @@ var make64 = gen2(function* () {
34978
34976
  Object.entries(obj.properties ?? {}),
34979
34977
  filterMap2(([key, schema2]) => {
34980
34978
  const fullSchema = getSchema(schema2);
34979
+ schema2 = cleanupSchema(schema2);
34981
34980
  const isOptional = !required2.includes(key);
34982
34981
  const [enumNullable, filteredSchema] = filterNullable(fullSchema);
34983
34982
  return toSource(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tim-smart/openapi-gen",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Generate Effect http clients from OpenAPI specs",
5
5
  "bin": "main.js",
6
6
  "repository": {