Skip to content

Simplify YAML anchor pattern in devproxy-errors.yaml #1568

@waldekmastykarz

Description

@waldekmastykarz

Summary

The devproxy-errors.yaml example file wraps YAML anchors in a definitions property, borrowing a JSON Schema/OpenAPI convention that doesn't fit YAML idioms. YAML anchors are a native language feature and don't need a container.

Current behavior

Anchors are defined under a definitions: wrapper:

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

Proposed change

Move anchors to top-level keys, removing the unnecessary definitions nesting:

client_error_body: &client_error_body
  message: "Client Error"

server_error_body: &server_error_body
  message: "Server Error"

errors:
  ...

This is more idiomatic YAML while still keeping the anchors in a dedicated, visible location (not inlined on the first usage, which would be fragile). The schema already allows arbitrary top-level keys to support plugin config sections, so no schema changes are needed.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions