schemas
Copilot instructions85 starsChanged 30 days agoApache-2.0View on GitHub
This repository is the schema source of truth for Meshery APIs. OpenAPI under schemas/constructs/ drives Go models, TypeScript types, runtime schema exports, and RTK Query clients that downstream repos consume. Prefer changing schema sources and manual helper/export files; avoid editing generated output directly. The Makefile wires several Node regression tests (make site-data-test, make test-enums-ts, make test-rtk, make test-gofmt); the other .test.js files under tests/ are run directly with node --test.
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,336 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- chrome-devtools-axiSkill
- create-openapi-schemas-from-golang-modelsSkill
- cut-releaseSkill
- gh-axiSkill
- iterate-prSkill
- lavishSkill
- openapi-schema-best-practicesSkill
- quota-axiSkill
- create-openapi-schemas-from-golang-modelsSkill
- meshery-schemas-releaseSkill
- openapi-schema-best-practicesSkill
The file
We split this copilot-instructions.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 66
Treat generated output as derived artifacts: do not hand-edit models/, typescript/generated/, or dist/.
- Very specific: line 70
Keep templates updated: when schema shapes or defaults change, update the matching templates/*_template.json and templates/*_template.yaml.
- Very specific: line 71
x-generate-db-helpersis schema-level only: use it on named schema components stored as JSON blobs in one DB column. - Very specific: line 73
HTTP design is enforced by validation: create-only POST endpoints should return 201.
≈ “Common” is an estimate: at least 1 in 5 of the 3,779 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot instructions for meshery/schemas
This repository is the schema source of truth for Meshery APIs. OpenAPI under schemas/constructs/ drives Go models, TypeScript types, runtime schema exports, and RTK Query clients that downstream repos consume. Prefer changing schema sources and manual helper/export files; avoid editing generated output directly.
Build, test, and validation commands
# Initial setup
make setup
# Primary validation and generation flow
make validate-schemas
make build
npm run build
# Focused generation steps
make bundle-openapi
make generate-golang
make generate-rtk
npm run generate:types
node build/index.js bundle
node build/index.js golang
node build/index.js rtk
node build/index.js types
node build/index.js all
# Lint
make golangci
# Go tests
go test ./...
go test ./validation/...
go test ./validation/... -run TestRuleName
# Node tests
make test-rtk
node --test tests/generate-rtk.test.js
node --test --test-name-pattern="guardOptionalQueryParams" tests/generate-rtk.test.js
node --test tests/validate-schemas-generate-golang.test.js
# Advisory and strict validation modes
make audit-schemas
make audit-schemas-full
make audit-schemas-style-full
make audit-schemas-debt-full
make validate-schemas-strict
# Cross-repo drift audit (optional sibling checkouts)
make consumer-audit MESHERY_REPO=../meshery CLOUD_REPO=../meshery-cloud EXTENSIONS_REPO=../meshery-extensionsThe Makefile wires several Node regression tests (make site-data-test, make test-enums-ts, make test-rtk, make test-gofmt); the other .test.js files under tests/ are run directly with node --test.
High-level architecture
- Schema source layout: each construct lives under
schemas/constructs/<version>/<construct>/.api.ymlis the construct entrypoint used for discovery, endpoint definitions, and$refwiring. Sibling*.yamlfiles hold entity/subschemas, andtemplates/holds example JSON/YAML instances that must stay in sync with schema changes. - Discovery and bundling: the JavaScript build layer auto-discovers constructs by walking
schemas/constructs/for directories containingapi.yml(build/lib/config.js).bundle-openapi.jsdereferences each construct into_openapi_build/constructs/<version>/<package>/merged-openapi.json, then merges non-deprecated APIs into_openapi_build/merged_openapi.ymlplus filteredcloud_openapi.ymlandmeshery_openapi.yml. - Code generation: bundled specs feed
generate-golang.js,generate-typescript.js, andgenerate-rtk.js, producingmodels/,typescript/generated/, andtypescript/rtk/.npm run buildthen packages the published TypeScript distribution indist/viatsup. - Manual export surface:
typescript/index.tsis not generated. It decides which generated types and schema objects are publicly exported, and some large schema imports stay commented out intentionally to keep the bundle smaller. - Validation and audits:
validation/is a dependency-leaf Go package used for build-time schema auditing (cmd/validate-schemas), runtime OpenAPI document validation in downstream consumers, andcmd/consumer-audit, which compares schemas against Meshery and Meshery Cloud routers plus RTK Query clients in Meshery, Meshery Cloud, and Meshery Extensions to catch API drift.
Key conventions
- Dual-schema pattern is the target pattern for entity constructs:
<construct>.yamlis the response schema for the full persisted entity. New or version-bumped writable entity APIs should usually use a separate*Payloadschema inapi.yml, but existing published versions may still use*Requestbodies. Never use the entity schema as aPOSTorPUTrequest body. api.ymlis the construct index: adding a new subschema file is not enough; it must be referenced from that construct'sapi.ymlor generation/validation will miss it.- Treat generated output as derived artifacts: do not hand-edit
models/,typescript/generated/, ordist/. Manual extension points are schema YAML files,models/*/*_helper.go,models/core/*,typescript/index.ts, build scripts, and validation code. - The shared Go core package is unversioned: schema references still use
schemas/constructs/v1alpha1/core/api.yml, but Go type imports for core types must resolve togithub.com/meshery/schemas/models/corewith aliascore. - Canonical wire naming targets camelCase: see
docs/identifier-naming-contributor-guide.mdfor the full directory. For newly authored API versions, JSON/schema/query identifiers and path parameters use camelCase, path/query IDs use anIdsuffix, schema component names use PascalCase, and path segments use kebab-case, while DB column names stay snake_case indb:tags. Legacy published versions may intentionally retain snake_case on the wire, and list endpoints may still reference shared core query params such aspagesize; follow the contract actually used by that version rather than partially recasing it. - Every operation needs
x-internal: it controls whether an endpoint lands in the Meshery bundle, the Cloud bundle, or both. Missingx-internalfails validation and bundling. - Keep templates updated: when schema shapes or defaults change, update the matching
templates/*_template.jsonandtemplates/*_template.yaml. x-generate-db-helpersis schema-level only: use it on named schema components stored as JSON blobs in one DB column. For amorphous objects, preferx-go-type: "core.Map"instead.- SQL helper behavior is type-family specific:
core.Map-style JSON helpers serialize nil values to JSON"null",core.NullTimereturns SQLNULL, and some slice helpers persist empty arrays. Match the existing helper family's nil/zero-value semantics, and make newScan()implementations reset the receiver in a way that matches the type's zero value whensrcis nil. - HTTP design is enforced by validation: create-only
POSTendpoints should return201; bulk deletes usePOST .../delete, notDELETEwith a request body;operationIdmust be lower camelCase verbNoun. - Two repo-specific exceptions matter:
schemas/constructs/v1beta1/design/generates the Go/TS package namepattern, and deprecated constructs remain in-tree for compatibility even when excluded from merged OpenAPI bundles. - Migration rule: while a construct is actively being migrated into this repo, the downstream implementation is the field-discovery reference. Once the schema is established here, this repo becomes authoritative and downstream code should conform to it.
Intentional design decisions
SqlNullTimeis still valid in some entities for backward compatibility with v1beta1 and downstream ORM consumers.x-enum-casing-exempt: truemarks published enum values that must not be lowercased.x-id-format: externalis the correct escape hatch for non-UUID identifiers such as external billing IDs.- Deprecated constructs marked with
info.x-deprecated: truestay in the repository for compatibility; they are excluded from merged OpenAPI output dynamically rather than being deleted. - Legacy pagination fields like
page_sizeandtotal_countmay remain in existing published API versions, but new canonical-casing versions should usepageSizeandtotalCount.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

