Skip to content

cli+engine: let a caller lower the severity of parser findings that don't affect lowering #691

Open

Description

@OmarAlJarrah

Problem

Parser findings arrive at the parser's severity, and an error fails the run. Some of them don't affect what the compiler produces: a path parameter written required: false is lowered as required anyway, an invalid contact.email changes nothing, a callback key the parser misreads is kept regardless. For those, exit 1 is stricter than the document's problems warrant, and a user can only work around it by post-processing output.

Proposal

Per-code severity overrides alongside the allowlist #79 describes, keyed by diagnostic code (and optionally entity), never by message text. Ship a documented lenient profile that lists the parser rules whose findings don't change lowering. The default stays strict.

Activity

  1. added
    priority:P1Core first-emitter feature on mainstream specs
    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formats
    and removed
    priority:P1Core first-emitter feature on mainstream specs
    on Oct 19, 2026
  2. OmarAlJarrah commented on Nov 1, 2026

    @OmarAlJarrah
    MemberAuthor

    Re-ranked from P4 to P1 on a new measure of what this proposal decides.

    #1226 keeps a security requirement naming a scheme the document does not hold, and leaves the finding an error, since the specification requires the name to correspond to a scheme. It gives that error a code of its own, openapi/unresolved-security-scheme, so an override can name exactly it, and nothing the IR lost goes with it. On the golden spec that code is now the only error:

    $ morphic compile openapi.json -o ir.json 2> diags.txt; echo $?
    1
    $ awk '$1 == "error" {print $2}' diags.txt | sort | uniq -c
       9 openapi/unresolved-security-scheme

    The engine starts an emitter only on a run that has not failed (docs/architecture.md section 4), so reaching one on the golden spec takes --fail-on none today, which also passes any other error a later spec revision draws. A per-code override reaches it and keeps the gate for everything else, and Document.Auth gives an entity-keyed entry an ID to name (auth/unresolved/components/securitySchemes/<name>), which the allowlist in docs/architecture.md section 4 and #79 describes.

    The proposal above speaks of parser findings that do not affect lowering. This finding does affect what an SDK does, and the IR states it, so the lenient profile should not be assumed to take it: which default a profile sets is a separate choice from being able to name the code.

    Priority: P1, rule 5 (direct impact: a pipeline decision that decides whether the golden spec's document reaches an emitter, with --fail-on none as the workaround, so not P0). morphic compile openapi.json; echo $? → 1, with 9 error openapi/unresolved-security-scheme and no other error (spec @319dc756, morphic @1e6f323f).

  3. added
    priority:P1Core first-emitter feature on mainstream specs
    and removed
    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formats
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P1Core first-emitter feature on mainstream specstype:featureNew capability or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions