module Analyzer::Specification::SchemaApiCommon

Overview

Shared primitives for the schema-generated API analyzers (Strapi, Directus, Payload, Supabase/PostgREST, Hasura, Appwrite).

These platforms all derive their HTTP surface from a schema file rather than from route declarations in source, so they share the same building blocks: turn a resource name into CRUD URLs, turn a attribute list into params, and tag the result.

Deliberately primitives rather than a base class or a unified emit_crud. The six diverge exactly where a shared CRUD routine would have to commit: Hasura has no CRUD skeleton at all (GraphQL only), PostgREST has no item URL (rows are addressed by filter), and Payload/Appwrite carry large non-CRUD route families. Each analyzer spells out its own verb sequence the way Analyzer::Specification::OData#emit_entity_set does.

Extended Modules

Direct including types

Defined in:

analyzer/analyzers/specification/schema_api_common.cr

Instance Method Summary

Instance Method Detail

def emit(sink : Array(Endpoint), url : String, method : String, params : Array(Param), details : Details, tag_name : String, tag_value : String, tag_source : String) : Endpoint #

Appends one endpoint, tagged so --exclude/filtering can target a single platform or a single operation kind.


[View source]
def join_path(prefix : String, path : String) : String #

Joins a mount prefix to a route path without doubling or dropping the separator.


[View source]
def normalize_colon_path(path : String) : String #

/:id -> /{id}. Emit the brace form so the optimizer's add_path_parameters pass picks the segment up: normalize_url_shape only rewrites the colon form for insomnia/postman, so a :id emitted here would survive verbatim into output.


[View source]
def push_param_once(params : Array(Param), param : Param) : Nil #

Dedups on (name, param_type), mirroring Endpoint#push_param. Used while a param array is still being assembled, before the Endpoint exists.


[View source]
def type_hint(raw : String, table : Hash(String, String)) : String #

Maps a platform type token to the small vocabulary Noir uses for Param#value hints. Unknown types produce an empty hint rather than a guess.


[View source]