Skip to content

Correction: subscription example uses flow-style YAML rejected by strict parser (P-037) #286

Description

@hdamker

Problem description

The next CAMARA validation update (tooling 0.7.0) adds advisory rule P-037 (OpenAPI YAML parser conformance), which parses each API definition with a strict YAML 1.2 parser (js-yaml@5). The CREATE_SUBSCRIPTION examples in the following definitions are written with JSON-like flow-style YAML that tolerant parsers accept but the strict parser rejects:

  • code/API_definitions/connected-network-type-subscriptions.yaml
  • code/API_definitions/device-reachability-status-subscriptions.yaml
  • code/API_definitions/device-roaming-status-subscriptions.yaml

Each has the same shape, e.g.:

        sinkCredential: {
          "credentialType": "ACCESSTOKEN",
          "accessToken": "xxx",
          "accessTokenExpiresUtc": "2024-02-17T16:23:45Z",
          "accessTokenType": "bearer"
        }

P-037 reports deficient indentation. The finding is advisory (warning); it does not block validation or merge, but it will surface on PRs after the validation update rolls out.

A strict parser stops at the first error, so P-037 reports only one location per file at a time. Each example actually contains several multiline flow-style constructs — sinkCredential, types, and config (including the nested subscriptionDetail / device) — so fixing only the first reported line will surface the next one on re-validation.

Expected behavior

In each of the three files, rewrite the entire CREATE_SUBSCRIPTION example value in plain block-style YAML so the whole document parses with YAML 1.2-conformant parsers. The data is unchanged — only the formatting:

      value:
        sink: "https://endpoint.example.com/sink"
        sinkCredential:
          credentialType: ACCESSTOKEN
          accessToken: xxx
          accessTokenExpiresUtc: "2024-02-17T16:23:45Z"
          accessTokenType: bearer
        protocol: HTTP
        types:
          - <event-type URN for the file, unchanged>
        config:
          subscriptionDetail:
            device:
              phoneNumber: "+123456789"
          subscriptionExpireTime: "2023-01-17T13:18:23.682Z"
          subscriptionMaxEvents: 5
          initialEvent: true

Apply the same block-style treatment to any other flow-style example mappings or sequences elsewhere in the files.

Alternative solution

None needed — this is a formatting-only correction.

Additional context

See the P-037 FAQ.

Minor note (not part of the P-037 finding): in each file's config.subscriptionDetail.device the phoneNumber entry has a trailing comma. This is valid YAML and does not affect the parser, but it implies a dangling/empty field — worth dropping while reformatting (the block-style example above already omits it).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions