fix(linter): skip the $id check for OpenAPI and OpenRPC service definitions - #49
Open
yingzhehu-TT wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@googlebot I signed it! |
yingzhehu-TT
force-pushed
the
fix/lint-skip-id-check-for-service-definitions
branch
from
August 12, 2026 08:19
d2a4a34 to
85603b3
Compare
damaz91
previously approved these changes
Aug 12, 2026
damaz91
approved these changes
Aug 14, 2026
carolinerg1
approved these changes
Aug 20, 2026
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
W002"schema missing$id" warning on a document-type check.is_service_definition(): a document declaring a version string under a rootopenapioropenrpckey is a service definition, not a JSON Schema.and a JSON Schema that merely has a property named
openapistill warns.Motivation
lint_filetreats every.jsonfile it is handed as a JSON Schema. OpenAPI andOpenRPC documents are not JSON Schemas, and neither root object defines
$id—so the warning asks authors to add a key their own specification does not permit.
The effect is not cosmetic. On the UCP repository at
7dc6c11:All six failures are
W002, and all six are service definitions:handlers/tokenization/openapi.jsonopenapi,info,pathsservices/payment-actions/embedded.openrpc.jsonopenrpc,info,serversservices/shopping/embedded.openrpc.jsonopenrpc,info,serversservices/shopping/mcp.openrpc.jsonopenrpc,info,serversservices/shopping/permalink.openapi.jsonopenapi,info,serversservices/shopping/rest.openapi.jsonopenapi,info,serversZero genuine JSON Schema files in that tree lack
$id. So--strictreports a100% false-positive rate on the UCP source tree, and the flag cannot be adopted
in CI — the one thing it currently blocks on is a warning that does not apply.
Scope
Only the
W002check is gated.$refresolution,ucp_*annotation checks,requireschecks and theexamplesconformance check continue to run on servicedefinitions unchanged — those documents do carry
$refs, and a broken one thereis still a real defect worth reporting.
The detection deliberately requires the root value to be a string. A JSON
Schema that describes an OpenAPI document has an
openapiproperty whose valueis a subschema object; that must keep warning, and the third test pins it.
Validation
cargo test— full suite passes, including the 3 new tests(
lint_openapi_service_definition_skips_missing_id_warning,lint_openrpc_service_definition_skips_missing_id_warning,lint_non_string_openapi_property_still_warns).cargo clippy --all-targets -- -D warnings— clean (exit 0).cargo fmt --check— clean.End-to-end against
Universal-Commerce-Protocol/ucp@7dc6c11:ucp-schema lint --strict source/exit 1— 100 checked, 94 passed, 6 failedexit 0— 100 checked, all passedNon-strict
ucp-schema lint source/output is byte-identical before and afterapart from the removed warnings, confirming no other behaviour changed.
Follow-up (not in this PR)
With this fixed,
ucp-schema lint --strict source/becomes adoptable in the UCPrepo's CI. That is a natural next step for
.github#21,but it has to wait for a release carrying this change.