Skip to main content

infer_annotations_from_method

Function infer_annotations_from_method 

Source
pub fn infer_annotations_from_method(method: &str) -> ModuleAnnotations
Expand description

Infer behavioral annotations from an HTTP method.

Mapping:

  • GET -> readonly=true, cacheable=true
  • DELETE -> destructive=true
  • PUT -> idempotent=true
  • POST -> default (all false; creates resources, not idempotent by spec)
  • PATCH -> default (partial update, not standardly idempotent)
  • HEAD / OPTIONS / unknown -> default (all false)

Note: HEAD and OPTIONS intentionally return all-false defaults to match the Python and TypeScript implementations. They do NOT receive readonly=true.