Fix @tomic/cli ontology codegen for did:ad subjects - #1309
Open
joepio wants to merge 1 commit into
Open
Conversation
DID resources keep did:ad:… as @id even when fetched via https://host/did:ad:…. The JSON-AD parser treated that as a mismatch, and the CLI had no server origin for a raw DID (connection refused / window is not defined in Node). Treat the HTTP path as an alias of the DID, resolve DIDs through GET /did?subject= with serverUrl, and derive that origin from HTTP ontology URLs when the config still has the init localhost default. Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
joepio
marked this pull request as ready for review
August 27, 2026 05:27
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.
Related Issues
Fixes
ad-generate ontologiesfailing on DID ontologies.What was going on
A
did:ad:…identifier is not an HTTP URL. Two config shapes both failed:"ontologies": ["did:ad:…"]— the CLI fetched throughGET {serverUrl}/did?subject=…. With no (or localhost)serverUrl, Node has nowindow.locationto fall back to, so the request never reached the Atomic Server that actually hosts the ontology (connection refused)."ontologies": ["https://host/did:ad:…"]— that URL is only a server-specific alias. The server still returns@id: did:ad:…. The JSON-AD parser required an exact subject match and threwResource has wrong subject in @id.What changed
https://host/did:ad:…(and/did?subject=) as aliases of the DID. Parse, fetch, and store lookup all follow the canonical@id./did?subject=usingserverUrl. In Node, missingserverUrlis a clear error instead of touchingwindow.@tomic/cliwritesserverUrlfromad-generate init, points the store at an HTTP ontology URL's origin so nested DID classes/properties resolve, and prints the real fetch error plus aserverUrlhint on connection refused.did:ad:…inontologiesand setserverUrlto the Atomic Server origin.Checklist