Skip to content

docs: add draft public and event contracts - #9

Merged
jaavid merged 3 commits into
mainfrom
agent/document-repository-entrypoints
Jul 25, 2026
Merged

docs: add draft public and event contracts#9
jaavid merged 3 commits into
mainfrom
agent/document-repository-entrypoints

Conversation

@jaavid

@jaavid jaavid commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Add a draft OpenAPI 3.1 contract for the locally verified Tenant → Device → Provisioning → Command slice.
  • Add a draft AsyncAPI command-event envelope and channel.
  • Document draft maturity, neutral public terminology, and the remaining admin/internal contract gap.

Validation

  • OpenAPI and AsyncAPI YAML parse successfully.
  • Contract structure check reports 4 OpenAPI paths and 1 AsyncAPI channel.
  • git diff --check passes.

Scope note

These are draft contracts for the presentation slice, not a claim of full API compatibility or release stability.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f58893bd44

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread openapi/corelink-public-v1.yaml Outdated
required: [id, tenant_id, device_model_id, status]
properties:
corelink_device_id: {type: string, format: uuid}
id: {type: string, format: uuid}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Expose the canonical corelink_device_id field

The public Device response exposes its canonical identifier as id, while the repository's public-contract rule explicitly defines it as corelink_device_id; related provisioning, command, path, and event fields also use device_id. SDKs generated from this document will therefore omit the promised public identifier and establish an incompatible naming convention at the contract boundary. Use corelink_device_id consistently throughout the public contract.

Useful? React with 👍 / 👎.

Comment thread openapi/corelink-public-v1.yaml Outdated
required: [device_model_id]
properties:
device_model_id: {type: string, format: uuid}
name: {type: string, maxLength: 255, nullable: true}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Express nullable names using OpenAPI 3.1 types

Under OpenAPI 3.1, nullable: true no longer extends type: string to include JSON null, so standards-compliant validators and generators will reject null despite the schema clearly intending to allow it. This affects both DeviceCreate.name here and Device.name later in the document; declare the type as a union including null instead.

Useful? React with 👍 / 👎.

Comment thread asyncapi/corelink-events-v1.yaml Outdated
type: object
additionalProperties: false
required: [event_id, event_type, occurred_at, tenant_id, data]
required: [id, type, version, occurred_at, tenant_id, correlation_id, payload, metadata]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require device identity on command events

For command-event payloads, this required list allows an envelope with no device_id, even though the channel is documented as partitioned by that identity and the property is defined below. Consumers validating against this contract therefore cannot rely on every command event identifying its device, which prevents safe routing or correlation; add the canonical device identifier to required.

Useful? React with 👍 / 👎.

Comment thread openapi/corelink-public-v1.yaml Outdated
Comment on lines +64 to +65
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
/api/v1/tenants/{tenant_id}/devices/{corelink_device_id}/commands:
'409': {$ref: '#/components/responses/Conflict'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the provisioning authorization failure

When an authenticated actor lacks permission for the tenant in this path, provisioning has the same 403 authorization outcome as the neighboring device and command operations, but this response list exposes only 401 and 409. Generated clients and mocks consequently treat a legitimate tenant-authorization response as undocumented, contrary to the repository rule that every operation define authorization failures; add the shared Forbidden response.

Useful? React with 👍 / 👎.

Comment on lines 85 to 87
'401': {$ref: '#/components/responses/Unauthorized'}
'403': {$ref: '#/components/responses/Forbidden'}
'404': {$ref: '#/components/responses/NotFound'}
'409': {$ref: '#/components/responses/Conflict'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document missing-resource responses for nested operations

When an authenticated caller with access to a tenant supplies an unknown device UUID, the provisioning and command operations need to report that the nested resource does not exist, but neither response set defines a 404 and there is no reusable not-found response. Generated clients and mocks will therefore treat this routine lookup outcome as an undocumented response; add a problem-shaped 404 response to the nested operations.

Useful? React with 👍 / 👎.

Comment thread openapi/corelink-public-v1.yaml Outdated
Comment on lines +31 to +34
post:
tags: [Devices]
summary: Register a canonical device
operationId: createDevice
x-corelink-stability: stable
tags: [devices]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require idempotency keys on resource creation

For a client retry after a timeout, the tenant and device creation POSTs provide no idempotency mechanism, unlike the provisioning and command POSTs defined below. The same logical request can therefore create a duplicate resource or produce a conflict whose result cannot be correlated with the original call, despite the repository rule that operations define idempotency; apply the shared IdempotencyKey parameter to both creation operations.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant