@nestia/sdk 14.2.0 → 14.2.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ORGANIZATION/PROJECT-api",
3
- "version": "14.2.0",
3
+ "version": "14.2.1",
4
4
  "description": "SDK library generated by Nestia",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -1257,6 +1257,7 @@ func nestiaSDKMarkReadonlySchemaType(prog *driver.Program, typ *shimchecker.Type
1257
1257
  if visiting[key] { return }
1258
1258
  visiting[key] = true
1259
1259
  if typ.Flags() & (shimchecker.TypeFlagsUnion | shimchecker.TypeFlagsIntersection) != 0 {
1260
+ if typ.Flags() & shimchecker.TypeFlagsUnion != 0 && nestiaSDKReadonlyScalarUnion(target) { return }
1260
1261
  for _, child := range typ.AsUnionOrIntersectionType().Types() {
1261
1262
  matched := false
1262
1263
  if typ.Flags() & shimchecker.TypeFlagsUnion != 0 {
@@ -1339,6 +1340,51 @@ func nestiaSDKMarkReadonlySchemaType(prog *driver.Program, typ *shimchecker.Type
1339
1340
  }
1340
1341
  }
1341
1342
 
1343
+ // nestiaSDKReadonlyScalarUnion reports whether a union schema has only
1344
+ // terminal scalar branches, so no constituent can own a readonly array marker.
1345
+ //
1346
+ // Readonly markers attach to array and tuple positions. A branch whose type is
1347
+ // string, number, integer, boolean or null and which carries no reference,
1348
+ // composition, object or array keyword contains no such position, so pairing
1349
+ // its constituent through MetadataFactory.Analyze cannot change the document.
1350
+ // A branch without an explicit scalar type, and every other shape, keeps the
1351
+ // constituent probe.
1352
+ func nestiaSDKReadonlyScalarUnion(schema map[string]any) bool {
1353
+ if !nestiaSDKReadonlyScalarShape(schema, true) { return false }
1354
+ found := false
1355
+ for _, keyword := range []string{"oneOf", "anyOf"} {
1356
+ if _, exists := schema[keyword]; !exists { continue }
1357
+ branches := nestiaSDKSchemaList(schema[keyword])
1358
+ if len(branches) == 0 { return false }
1359
+ found = true
1360
+ for _, branch := range branches {
1361
+ if !nestiaSDKReadonlyScalarShape(nestiaSDKSchemaMap(branch), false) { return false }
1362
+ }
1363
+ }
1364
+ return found
1365
+ }
1366
+
1367
+ // nestiaSDKReadonlyScalarShape reports whether one schema has no position that
1368
+ // could hold a readonly array marker. allowUnion admits the oneOf/anyOf parent
1369
+ // whose branches nestiaSDKReadonlyScalarUnion checks separately.
1370
+ func nestiaSDKReadonlyScalarShape(schema map[string]any, allowUnion bool) bool {
1371
+ if schema == nil { return false }
1372
+ if value, exists := schema["type"]; exists {
1373
+ switch value {
1374
+ case "string", "number", "integer", "boolean", "null":
1375
+ default: return false
1376
+ }
1377
+ } else if !allowUnion { return false }
1378
+ for _, key := range []string{"$ref", "$dynamicRef", "$recursiveRef", "allOf", "not", "if", "then", "else", "properties", "patternProperties", "additionalProperties", "unevaluatedProperties", "dependentSchemas", "propertyNames", "items", "prefixItems", "additionalItems", "contains", "unevaluatedItems", "$defs", "definitions"} {
1379
+ if _, exists := schema[key]; exists { return false }
1380
+ }
1381
+ if !allowUnion {
1382
+ if _, exists := schema["oneOf"]; exists { return false }
1383
+ if _, exists := schema["anyOf"]; exists { return false }
1384
+ }
1385
+ return true
1386
+ }
1387
+
1342
1388
  // nestiaSDKReadonlySchemaEquivalent compares the native writer's branch shape,
1343
1389
  // ignoring only the readonly facts this traversal has already attached.
1344
1390
  func nestiaSDKReadonlySchemaEquivalent(expected any, actual any) bool {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestia/sdk",
3
- "version": "14.2.0",
3
+ "version": "14.2.1",
4
4
  "description": "Nestia SDK and Swagger generator",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -57,11 +57,11 @@
57
57
  "tstl": "^3.0.0",
58
58
  "typia": "^15.3.0",
59
59
  "@babel/parser": "^7.29.8",
60
- "@nestia/fetcher": "^14.2.0",
61
- "@nestia/core": "^14.2.0"
60
+ "@nestia/core": "^14.2.1",
61
+ "@nestia/fetcher": "^14.2.1"
62
62
  },
63
63
  "peerDependencies": {
64
- "@nestia/core": "^14.2.0"
64
+ "@nestia/core": "^14.2.1"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@modelcontextprotocol/sdk": "^1.18.0",