Azure / Azure/azure-openapi-validator

additionalProperties should not be allowed with x-ms-client-flatten: true extension

Open
#135 0 comments 0 reactions 0 assignees View on GitHub
sdk-rule
Dominant language
TypeScript
Stars
53
Forks
57
Avg merge
1d 23h
Merged PRs (30d)
2

Description

The following will not be allowed.
`StorageAccountProperties` will be flattened so we would not know where to put the additionalProperties.

```json5
{
"StorageAccount": {
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/StorageAccountProperties"
}
}
},
"StorageAccountProperties": {
"additionalProperties": {
"type" : "object"
},
"properties": {
"p1": {
"type": "string"
},
"p2": {
"type": "string"
}
}
}
}
```

Moreover, it gets complicated if the `StorageAccount` object also had `"additionalProperties": {"type": "object"}`. Then the modeler will have a conflict between the top level additionalProperties and flattened additionalProperties.

So it is in the best interest to not allow model flattening along with additionalProperties.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.