Skip to content

fix: simplify YAML anchor pattern in devproxy-errors.yaml#1569

Merged
garrytrinder merged 1 commit intodotnet:mainfrom
waldekmastykarz:fix/simplify-yaml-anchors
Mar 2, 2026
Merged

fix: simplify YAML anchor pattern in devproxy-errors.yaml#1569
garrytrinder merged 1 commit intodotnet:mainfrom
waldekmastykarz:fix/simplify-yaml-anchors

Conversation

@waldekmastykarz
Copy link
Collaborator

Summary

Removes the unnecessary definitions: wrapper from devproxy-errors.yaml and promotes YAML anchors to top-level keys.

YAML anchors are a native language feature and don't need a JSON Schema/OpenAPI-style container. The schema already allows arbitrary top-level keys, so no schema changes are needed.

Before

definitions:
  client_error_body: &client_error_body
    message: "Client Error"
  server_error_body: &server_error_body
    message: "Server Error"

After

client_error_body: &client_error_body
  message: "Client Error"

server_error_body: &server_error_body
  message: "Server Error"

Closes #1568

@waldekmastykarz waldekmastykarz requested a review from a team as a code owner February 28, 2026 09:41
Copilot AI review requested due to automatic review settings February 28, 2026 09:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the YAML anchor pattern in DevProxy/devproxy-errors.yaml by removing the unnecessary definitions: wrapper object and promoting the YAML anchors (client_error_body, server_error_body) directly to top-level keys. This makes the file more idiomatic YAML — anchors are a native YAML language feature and do not need a JSON Schema/OpenAPI-style container. The v2.2.0 genericrandomerrorplugin.errorsfile.schema.json already has "additionalProperties": true at the root level, so the promoted keys are fully schema-compliant.

Changes:

  • Removes the definitions: wrapper object from devproxy-errors.yaml
  • Promotes client_error_body and server_error_body anchor definitions to top-level keys (reducing one level of indentation for each)

Copy link
Contributor

@garrytrinder garrytrinder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built and tested in detached mode with a config pointing to the YAML errors file. 1 error responses loaded from devproxy-errors.yaml — simplified top-level anchors work correctly. Schema has additionalProperties: true so the extra top-level keys are fine. LGTM.

@garrytrinder garrytrinder enabled auto-merge (squash) March 2, 2026 10:46
Remove the unnecessary `definitions` wrapper and promote YAML anchors
to top-level keys. This is more idiomatic  anchors are a nativeYAML
language feature and don't need a JSON Schema/OpenAPI-style container.

Closes dotnet#1568

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@garrytrinder garrytrinder force-pushed the fix/simplify-yaml-anchors branch from 763cac2 to ecbe88a Compare March 2, 2026 10:54
@garrytrinder garrytrinder merged commit 92ed12c into dotnet:main Mar 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify YAML anchor pattern in devproxy-errors.yaml

3 participants