Azure / Azure/azure-openapi-validator

Dealing with additionalProperties

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

Description

- `"additionalProperties" inside the model `"properties"`
If a model contains a property named "additionalProperties" then the linter should issue a **warning**.

example:
```json5
{
"Foo": {
"properties": {
"additionalProperties": {
"type": "object"
}
}
}
}
```

- **conflict** `"additionalProperties" inside the model `"properties"` as well as outside the model `"properties"`.
If a model contains a property named additionalProperties and also contains additionalProperties on the outside (sibling of properties) then the linter should **throw an error**. Because having additionalProperties on the outside has a special meaning in Json schema.

example 1:
```json5
{
"Foo": {
"properties": {
"additionalProperties": {
"type": "object"
}
},
"additionalProperties": true
}
}
```
example2:
```json5
{
"Foo": {
"properties": {
"additionalProperties": {
"type": "object"
}
},
"additionalProperties": {
"type": "string" // could be "object" | "number" | any other valid value for the type
}
}
}
```

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.