Merged
Conversation
Print the OpenAPI operation object for an X-point endpoint, mirroring `gws schema`. The X-point OpenAPI 3.0.3 spec is embedded in the binary via go:embed. Supported aliases map to the CLI's existing commands: form.list GET /api/v1/forms approval.list GET /api/v1/approvals document.search POST /api/v1/search/documents Flags: --resolve-refs inline local $ref pointers into the output --jq apply a gojq filter to the schema Running `xp schema` without arguments lists the supported aliases. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The upstream X-point OpenAPI spec has schema/example inconsistencies (notably `form[].id` typed as string while the API actually returns integer). Since the API response is the source of truth, drop the embedded openapi.yaml in favor of a hand-maintained schema.yaml that covers only the operations this CLI supports and reflects the real response shapes. - Remove internal/xpoint/openapi.yaml (~9.5k lines) - Add internal/xpoint/schema.yaml describing form.list / approval.list / document.search with correct types - Simplify schema.go: drop $ref resolution, just lookup by alias - Drop --resolve-refs flag (no refs to resolve anymore) - Update tests and output field names (method/path instead of _method/_path) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ec2a6a7 to
f98d517
Compare
jq-style filtering belongs on runtime API responses where users care about trimming payloads, not on the static schema output. If users want to grep parts of the schema, piping through jq externally is simpler. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Embed schema.json instead of schema.yaml so we can use encoding/json from the stdlib and drop the gopkg.in/yaml.v3 dependency (and its map[any]any -> map[string]any normalizer). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Each operation now lives in its own file (form.list.json, approval.list.json, document.search.json) inside the new internal/schema package. Adding or editing an endpoint no longer requires touching a monolithic schema.json. The loader uses embed.FS with `//go:embed *.json` and derives the alias name from the filename (minus the .json suffix), so new operations can be added just by dropping a JSON file. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xp schema <service.resource.method>で X-point API の OpenAPI オペレーション定義を出力form.list→GET /api/v1/formsapproval.list→GET /api/v1/approvalsdocument.search→POST /api/v1/search/documents使用例
```console
$ xp schema
Supported aliases:
approval.list
document.search
form.list
$ xp schema form.list --jq '{summary, _method, _path}'
{
"_method": "GET",
"_path": "/api/v1/forms",
"summary": "利用可能フォーム一覧取得"
}
$ xp schema form.list --resolve-refs
$ref がすべて展開された JSON
```
Test plan
🤖 Generated with Claude Code