Building Blocks
Cohesive. Api
Cohesive.Api is a semantic API definition layer for operations, routes, request shapes, response variants, scope policies, transport metadata, and generated clients.
Define the API once as product semantics, then project it onto ASP.NET Minimal APIs, OpenAPI, GraphQL, TypeScript clients, test mocks, and future RPC bindings.
API As IR
An ApiDefinition contains endpoints and operations with stable operation ids, operation kinds, entity bindings, HTTP routes, parameters, query DTOs, request bodies, result variants, transition metadata, identity scope policies, summaries, tags, and transport metadata.
The API model can be emitted, served, projected, or bound without rebuilding those facts in every target.
Transport Projections
ASP.NET Minimal API bindings can map declared routes and attach Cohesive metadata to endpoints. OpenAPI projection can emit paths, parameters, schemas, operation ids, tags, and Cohesive-specific extensions. GraphQL projection can expose query and mutation views over the same model.
The API IR is also structured so gRPC or other RPC-oriented transports can preserve the same operation semantics.
Identity And Scope
Cohesive.Api integrates with Cohesive.Identity through scope policies. An operation can declare how scope is selected and checked: from a header, query parameter, route value, request body, ambient context, or resource-derived id.
That keeps authorization policy, transport parameter names, generated clients, and storage/process scope placement aligned.
Code Generation
API emitters can generate OpenAPI documents, GraphQL schemas, TypeScript clients, Playwright mocks, route constants, shape imports, and transport helpers from the same backend definition.
Frontend code should not need to hand-author endpoint strings, route encoders, scope header names, or response builders when the API IR already knows those facts.
Role In Cohesive
Cohesive.Api is the API surface for the rest of the Cohesive stack: identity policies, storage-backed entity queries, transition commands, process endpoints, generated frontend clients, and presentation actions.
