osury 0.28.0 → 0.29.0

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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "osury",
3
3
  "type": "module",
4
4
  "description": "Generate ReScript types with Sury schemas from OpenAPI specifications",
5
- "version": "0.28.0",
5
+ "version": "0.29.0",
6
6
  "license": "MIT",
7
7
  "bin": {
8
8
  "osury": "bin/osury.mjs"
@@ -32,7 +32,7 @@ function printPrimitive(p) {
32
32
 
33
33
  function printType(t) {
34
34
  if (typeof t !== "object") {
35
- return "JSON.t";
35
+ return "@s.matches(S.json) JSON.t";
36
36
  }
37
37
  switch (t.TAG) {
38
38
  case "Primitive" :
@@ -350,36 +350,20 @@ function buildSkipSchemaSet(schemas) {
350
350
  schemas.forEach(s => {
351
351
  let types = s.schema;
352
352
  let hasInlineProblem;
353
- let exit = 0;
354
353
  if (typeof types !== "object") {
355
- exit = 1;
354
+ hasInlineProblem = CodegenHelpers.hasUnion(s.schema);
356
355
  } else {
357
356
  switch (types._tag) {
358
357
  case "PolyVariant" :
359
- hasInlineProblem = types._0.some(c => {
360
- if (CodegenHelpers.hasUnion(c.payload)) {
361
- return true;
362
- } else {
363
- return CodegenHelpers.hasUnknown(c.payload);
364
- }
365
- });
358
+ hasInlineProblem = types._0.some(c => CodegenHelpers.hasUnion(c.payload));
366
359
  break;
367
360
  case "Union" :
368
- hasInlineProblem = types._0.some(t => {
369
- if (CodegenHelpers.hasUnion(t)) {
370
- return true;
371
- } else {
372
- return CodegenHelpers.hasUnknown(t);
373
- }
374
- });
361
+ hasInlineProblem = types._0.some(CodegenHelpers.hasUnion);
375
362
  break;
376
363
  default:
377
- exit = 1;
364
+ hasInlineProblem = CodegenHelpers.hasUnion(s.schema);
378
365
  }
379
366
  }
380
- if (exit === 1) {
381
- hasInlineProblem = CodegenHelpers.hasUnion(s.schema) || CodegenHelpers.hasUnknown(s.schema);
382
- }
383
367
  if (hasInlineProblem) {
384
368
  skipSet[s.name] = true;
385
369
  return;