osury 0.21.0 → 0.22.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/IRGen.res.mjs +29 -14
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.21.0",
5
+ "version": "0.22.0",
6
6
  "license": "MIT",
7
7
  "bin": {
8
8
  "osury": "bin/osury.mjs"
package/src/IRGen.res.mjs CHANGED
@@ -139,15 +139,22 @@ function convertToIrTypeDef(namedSchema, schemasDict, tagsDict, skipSchemaSet) {
139
139
  } else {
140
140
  let refName$1 = refName._0;
141
141
  let other = schemasDict[refName$1];
142
- payload = other !== undefined ? (
143
- typeof other !== "object" || other._tag !== "Object" ? convertType(other) : ({
144
- TAG: "InlineRecord",
145
- _0: other._0.map(convertField)
146
- })
147
- ) : ({
142
+ if (other !== undefined) {
143
+ if (typeof other !== "object" || other._tag !== "Object") {
144
+ payload = convertType(other);
145
+ } else {
146
+ let filtered = other._0.filter(f => f.name !== tagName);
147
+ payload = {
148
+ TAG: "InlineRecord",
149
+ _0: filtered.map(convertField)
150
+ };
151
+ }
152
+ } else {
153
+ payload = {
148
154
  TAG: "Named",
149
155
  _0: CodegenHelpers.lcFirst(refName$1)
150
- });
156
+ };
157
+ }
151
158
  }
152
159
  return {
153
160
  tag: CodegenHelpers.ucFirst(c._tag),
@@ -203,15 +210,23 @@ function convertToIrTypeDef(namedSchema, schemasDict, tagsDict, skipSchemaSet) {
203
210
  let tagValue = tagsDict[name];
204
211
  let tag = tagValue !== undefined ? CodegenHelpers.ucFirst(tagValue) : CodegenHelpers.ucFirst(name);
205
212
  let other = schemasDict[name];
206
- let payload = other !== undefined ? (
207
- typeof other !== "object" || other._tag !== "Object" ? convertType(other) : ({
208
- TAG: "InlineRecord",
209
- _0: other._0.map(convertField)
210
- })
211
- ) : ({
213
+ let payload;
214
+ if (other !== undefined) {
215
+ if (typeof other !== "object" || other._tag !== "Object") {
216
+ payload = convertType(other);
217
+ } else {
218
+ let filtered = other._0.filter(f => f.name !== tagName);
219
+ payload = {
220
+ TAG: "InlineRecord",
221
+ _0: filtered.map(convertField)
222
+ };
223
+ }
224
+ } else {
225
+ payload = {
212
226
  TAG: "Named",
213
227
  _0: CodegenHelpers.lcFirst(name)
214
- });
228
+ };
229
+ }
215
230
  return {
216
231
  tag: tag,
217
232
  payload: payload