_resource.json

Path: apis/<api>/resources/<resource>/_resource.json

Holds the IDE-specific metadata for a resource that isn't in the OpenAPI spec: creation defaults, notes, spec overrides, extra parameters, locally-defined operations, and plugin data. Operation details (schemas, responses) stay in the spec; this file only stores what you add on top.

Example

{
  "version": 1,
  "defaults": {
    "headers": { "Accept": "application/json" }
  },
  "overrides": {
    "description": "Everything about your pets."
  },
  "operations": {
    "create": {
      "defaults": { "body": { "status": "available" } },
      "notes": "Requires the write:pets scope.",
      "overrides": {
        "summary": "Add a new pet to the store",
        "responses": { "405": { "description": "Invalid input" } }
      },
      "parameters": {
        "X-Trace-Id": { "in": "header", "schema": { "type": "string" }, "description": "Tracing id" }
      }
    }
  }
}

Fields

FieldTypeDescription
version1File format version.
defaultsobjectCreation defaults for this resource's requests (auth, headers, cookies), merged after the API defaults.
overridesobjectResource-level spec overrides (projected onto the resource's tag, e.g. description).
operationsobjectPer-operation metadata, keyed by operation name (see below).
pluginsobjectPlugin-specific data, namespaced per plugin.

operations.<name>

FieldTypeDescription
defineobjectPresent only for a locally-defined operation: { method, path, operationId }. Its presence is what distinguishes a defined operation from a mapped one.
defaultsobjectCreation defaults for this operation, e.g. a template body.
notesstringFree-form notes, shown in the app.
overridesobjectOperation-level spec overrides (see below).
parametersobjectAdditional/overridden parameters, keyed by name.

Overrides

Overrides are projected onto the effective spec. At the operation level the overridable fields are summary, description, tags, deprecated, security, externalDocs, responses.<code>, requestBody, and x-* extensions. Identity fields (method, path, operationId) are not overridable; change those through schema rules.

Parameters

The parameters dictionary is keyed by parameter name. Each entry is merged into the effective spec's parameter list by identity (name + in). Setting an entry to nullremoves that parameter from the effective spec.

Locally-defined operations

The define block lets you add an operation the source spec doesn't have, useful for undocumented endpoints or APIs without a spec. The organizational part (which resource, what name) is created with craftr schema define; the full definition lives here:

"operations": {
  "vaccinations": {
    "define": { "method": "GET", "path": "/pet/{petId}/vaccinations", "operationId": "getPetVaccinations" },
    "overrides": { "summary": "List a pet's vaccinations" },
    "parameters": { "petId": { "in": "path", "required": true, "schema": { "type": "integer" } } }
  }
}
Coming soonPlugin data

The plugins namespace is part of the format so plugin config has a home, but the plugin system isn't built yet; see Plugins.