Skip to content

Commit

Permalink
add README
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed Dec 26, 2024
1 parent 1f7759c commit d47f880
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/argument_presets.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@ You can use argument presets to set default values to request arguments. Argumen
"value": 1
},
"targets": ["addPet"]
},
{
"path": "body.categories[*].id",
"value": {
"type": "literal",
"value": 1
},
"targets": []
}
]
}
}
```

The target argument field is removed from the `arguments` schema if the selector is the root field. If the path selects the nested field the target field becomes nullable.
The target argument field is removed from the `arguments` schema if the selector is the root field. If the path selects the nested field the target field becomes nullable. Support object properties and array selectors.

## Configuration options

Expand Down
1 change: 1 addition & 0 deletions ndc-http-schema/openapi/internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ func mergeUnionTypes(httpSchema *rest.NDCHttpSchema, a schema.Type, b schema.Typ
case slices.Contains(floatTypeRepresentations, typeRepA) && slices.Contains(floatTypeRepresentations, typeRepB):
scalarName = rest.ScalarFloat64
isMatched = true
// use boolean if the union type if oneOf boolean or enum (true, false)
case (enumA != nil && len(enumA.OneOf) == 2 && slices.Contains(enumA.OneOf, "true") && slices.Contains(enumA.OneOf, "false") && typeRepB == schema.TypeRepresentationTypeBoolean) ||
(enumB != nil && len(enumB.OneOf) == 2 && slices.Contains(enumB.OneOf, "true") && slices.Contains(enumB.OneOf, "false") && typeRepA == schema.TypeRepresentationTypeBoolean):
scalarName = rest.ScalarBoolean
Expand Down

0 comments on commit d47f880

Please sign in to comment.