From eb5643333f949dfe5b20262df586a0e9fab37761 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Sun, 4 Oct 2026 21:56:44 +0900 Subject: [PATCH] api,lexicons,spindle: object can't be inlined inside an object Official spec is bit ambiguious about this, but this is how both `@atproto/lexicon` and `@atcute/lex-cli` work: object can't be inlined inside an object. So use `ref` type instead. Signed-off-by: Seongmin Lee --- api/org_tangled/ciworkflow.go | 13 ++++++------ lexicons/org/tangled/ci/workflow.json | 28 ++++++++++++++----------- spindle/xrpc/org_tangled_ci_pipeline.go | 2 +- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/api/org_tangled/ciworkflow.go b/api/org_tangled/ciworkflow.go index 2fad72e37..8cf34e5de 100644 --- a/api/org_tangled/ciworkflow.go +++ b/api/org_tangled/ciworkflow.go @@ -43,14 +43,15 @@ type CiWorkflow_ExternalSource struct { // // RECORDTYPE: CiWorkflow_FileSource type CiWorkflow_FileSource struct { - LexiconTypeID string `json:"$type,const=org.tangled.ci.workflow#fileSource" cborgen:"$type,const=org.tangled.ci.workflow#fileSource"` - Commit string `json:"commit" cborgen:"commit"` - Lines *CiWorkflow_FileSource_Lines `json:"lines,omitempty" cborgen:"lines,omitempty"` - Path string `json:"path" cborgen:"path"` - Repo string `json:"repo" cborgen:"repo"` + LexiconTypeID string `json:"$type,const=org.tangled.ci.workflow#fileSource" cborgen:"$type,const=org.tangled.ci.workflow#fileSource"` + Commit string `json:"commit" cborgen:"commit"` + Lines *CiWorkflow_LineRange `json:"lines,omitempty" cborgen:"lines,omitempty"` + Path string `json:"path" cborgen:"path"` + Repo string `json:"repo" cborgen:"repo"` } -type CiWorkflow_FileSource_Lines struct { +// CiWorkflow_LineRange is a "lineRange" in the org.tangled.ci.workflow schema. +type CiWorkflow_LineRange struct { End int64 `json:"end" cborgen:"end"` Start int64 `json:"start" cborgen:"start"` } diff --git a/lexicons/org/tangled/ci/workflow.json b/lexicons/org/tangled/ci/workflow.json index 75bc278a7..e0539cb3c 100644 --- a/lexicons/org/tangled/ci/workflow.json +++ b/lexicons/org/tangled/ci/workflow.json @@ -58,18 +58,22 @@ "minLength": 1 }, "lines": { - "type": "object", - "required": ["start", "end"], - "properties": { - "start": { - "type": "integer", - "minimum": 1 - }, - "end": { - "type": "integer", - "minimum": 1 - } - } + "type": "ref", + "ref": "#lineRange" + } + } + }, + "lineRange": { + "type": "object", + "required": ["start", "end"], + "properties": { + "start": { + "type": "integer", + "minimum": 1 + }, + "end": { + "type": "integer", + "minimum": 1 } } }, diff --git a/spindle/xrpc/org_tangled_ci_pipeline.go b/spindle/xrpc/org_tangled_ci_pipeline.go index b482b799b..a58527e60 100644 --- a/spindle/xrpc/org_tangled_ci_pipeline.go +++ b/spindle/xrpc/org_tangled_ci_pipeline.go @@ -90,7 +90,7 @@ func toOrgWorkflowDefinition(definition *models.WorkflowDefinition) (*org_tangle Repo: file.Repo, Commit: file.Commit, Path: file.Path, } if file.Lines != nil { - mapped.Lines = &org_tangled.CiWorkflow_FileSource_Lines{Start: file.Lines.Start, End: file.Lines.End} + mapped.Lines = &org_tangled.CiWorkflow_LineRange{Start: file.Lines.Start, End: file.Lines.End} } source.CiWorkflow_FileSource = mapped case definition.Source.External != nil: -- 2.51.2