check_schema: Ignore operation field in schema validation for openapi.

In the openapi specs, the update_message_flags event is documented as
having a `operation` (deprecated) field, alongside the modern `op`.

This causes check_schemas warnings like this:

    NEED SCHEMA to match OpenAPI update_message_flags_add_add_event
    NEED SCHEMA to match OpenAPI update_message_flags_remove_remove_event

as check_schemas uses both `op` and `operation` for constructing the
event name.

Being deprecated (and really only still there for
backwards-compatibility with the original error of having it present),
`operation` will be removed eventually, therefore we can safely
ignore it from being used in openapi schema validation.

Part of #17568.
This commit is contained in:
shanukun 2021-03-16 22:21:39 +05:30 committed by Tim Abbott
parent a4cb264885
commit 7aa89289a3
1 changed files with 2 additions and 3 deletions

View File

@ -184,9 +184,8 @@ def validate_openapi_against_event_schema() -> None:
for sub_node in node:
name = sub_node["properties"]["type"]["enum"][0]
for key in ["op", "operation"]:
if key in sub_node["properties"]:
name += "_" + sub_node["properties"][key]["enum"][0]
if "op" in sub_node["properties"]:
name += "_" + sub_node["properties"]["op"]["enum"][0]
name += "_event"