Skip to content

Commit 6c10c4b

Browse files
committed
Rename required behavior_meta keys
1 parent a5aeb5c commit 6c10c4b

File tree

19 files changed

+374
-278
lines changed

19 files changed

+374
-278
lines changed

compiler/src/steps/validate-model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,11 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
644644
for (const parent of typeDef.behaviors) {
645645
validateTypeRef(parent.type, parent.generics, openGenerics)
646646

647-
if (parent.type.name === 'AdditionalProperty' && (parent.meta == null || parent.meta.name == null || parent.meta.value == null)) {
648-
modelError(`AdditionalProperty behavior for type '${fqn(typeDef.name)}' requires a 'behavior_meta' decorator with at least 2 arguments (name of name, name of value, description)`)
647+
if (parent.type.name === 'AdditionalProperty' && (parent.meta == null || parent.meta.key == null || parent.meta.value == null)) {
648+
modelError(`AdditionalProperty behavior for type '${fqn(typeDef.name)}' requires a 'behavior_meta' decorator with at least 2 arguments (key, value)`)
649649
}
650-
if (parent.type.name === 'AdditionalProperties' && (parent.meta == null || parent.meta.name == null || parent.meta.description == null)) {
651-
modelError(`AdditionalProperties behavior for type '${fqn(typeDef.name)}' requires a 'behavior_meta' decorator with exactly 2 arguments (name, description)`)
650+
if (parent.type.name === 'AdditionalProperties' && (parent.meta == null || parent.meta.fieldname == null || parent.meta.description == null)) {
651+
modelError(`AdditionalProperties behavior for type '${fqn(typeDef.name)}' requires a 'behavior_meta' decorator with exactly 2 arguments (fieldname, description)`)
652652
}
653653
}
654654
context.pop()

docs/behaviors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ We therefore document the requirement to behave like a dictionary for unknown pr
1616

1717
```ts
1818
/**
19-
* @behavior_meta AdditionalProperties name=sub_aggregations
19+
* @behavior_meta AdditionalProperties fieldname=sub_aggregations
2020
*/
2121
class IpRangeBucket implements AdditionalProperties<AggregateName, Aggregate> {}
2222
```
@@ -25,7 +25,7 @@ There are also many places where we expect only one runtime-defined property, su
2525

2626
```ts
2727
/**
28-
* @behavior_meta AdditionalProperty name=field value=bounding_box
28+
* @behavior_meta AdditionalProperty key=field value=bounding_box
2929
*/
3030
class GeoBoundingBoxQuery extends QueryBase
3131
implements AdditionalProperty<Field, BoundingBox>

0 commit comments

Comments
 (0)