Skip to content
Playground(another site)

bynk.parse.policy_order

Error A service's cors/security/limits policy is out of order or follows a handler; they open the body in the order cors, security, limits, json.

A service's policies open its body, before any handler, in one fixed order: cors, security, limits, then json, each optional. One fixed layout means a reader always finds a service's cross-cutting rules at the top, and the formatter has a single form to write. A policy after a later one, or after a handler, is refused. Reorder them. A policy given twice is a separate error, such as bynk.parse.duplicate_cors.

Example

service api from http {
limits { maxBody: 1_048_576 }
cors { origins: ["*"] } // ✗ `cors` comes before `limits`
on GET("/a") () -> Effect[HttpResult[Int]] by Visitor { … }
}
service api from http {
cors { origins: ["*"] } // ✓ policies in order
limits { maxBody: 1_048_576 }
on GET("/a") () -> Effect[HttpResult[Int]] by Visitor { … }
}

In the Book

See also

  • The grammar rule it governs: service_decl.
  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.policy_order shows the same from the installed toolchain, without a network.