mirror of
https://github.com/morluto/rea.git
synced 2026-11-23 15:05:51 +00:00
fix(cli): advertise parsed JSON documents in --schema
`--schema` for JSON-input CLI commands showed only an opaque
`inputJson` string, so callers could not see the document the command
actually parses. The argument now carries the decoded document as its
contentSchema, built from the same contract each command or its service
parses with (the Evidence input frame, or the ledger and coverage
request schemas). `$schema` is stripped, and a schema JSON Schema cannot
represent is refused rather than advertised as {}.
Fixes #9195
Supersedes #9283
Squashed from #9283 (with morluto's validation test) and rebased onto
main; the coverage test now expects boundary_id's stable-identifier
pattern from #9919. #9214 by 1052326311 took the same approach.
Co-Authored-By: morluto <76467478+morluto@users.noreply.github.com>
Co-Authored-By: 1052326311 <65798732+1052326311@users.noreply.github.com>
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
1 parent
3e95d22dd4
commit
d734e6424d
15 files changed
+625
-66
No files matched your search
@@ -6,6 +6,7 @@ import { CLI_COMMANDS } from "../cliCommandNames.js";
|
||||
import { parseCliJsonInput } from "../cliJsonInput.js";
|
||||
import { logCliCommand } from "../cliLogging.js";
|
||||
import { compareStaticObservedEndpointsFactsSchema } from "../contracts/javascript/applicationWorkflowInputContracts.js";
|
||||
import { jsonInputArgument } from "./jsonInputArgument.js";
|
||||
import { getEvidenceInputContract } from "../domain/evidenceInputContract.js";
|
||||
import { endpointComparisonViewRequestSchema } from "../domain/analysisView/endpointComparisonView.js";
|
||||
import { parseAnalysisInput } from "../application/AnalysisInput.js";
|
||||
@@ -23,6 +24,9 @@ import {
|
||||
} from "./analysisEvidenceDelivery.js";
|
||||
|
||||
const operation = "compare_static_and_observed_endpoints";
|
||||
const comparisonDocumentSchema = getEvidenceInputContract(
|
||||
compareStaticObservedEndpointsFactsSchema,
|
||||
).frameSchema;
|
||||
const deliverySchema = z
|
||||
.object({
|
||||
detail: analysisEvidenceDeliveryOptions.detail,
|
||||
@@ -73,8 +77,7 @@ const runComparison = async (
|
||||
const input = parseAnalysisInput(
|
||||
operation,
|
||||
raw.value,
|
||||
getEvidenceInputContract(compareStaticObservedEndpointsFactsSchema)
|
||||
.frameSchema,
|
||||
comparisonDocumentSchema,
|
||||
signal,
|
||||
);
|
||||
if (!input.ok) return projectAnalysisError(input.error);
|
||||
@@ -112,11 +115,10 @@ export const registerStaticObservedEndpointsCommand = (
|
||||
description:
|
||||
"Compare static JavaScript endpoints and HAR Evidence JSON offline; --detail summary with --evidence_output saves full facts for selected inspect-analysis-view pages",
|
||||
args: z.object({
|
||||
inputJson: z
|
||||
.string()
|
||||
.describe(
|
||||
"Inline JSON or file containing application, capture and optional origin",
|
||||
),
|
||||
inputJson: jsonInputArgument(
|
||||
"Inline JSON or file containing application, capture and optional origin",
|
||||
comparisonDocumentSchema,
|
||||
),
|
||||
}),
|
||||
options: commandOptions,
|
||||
run: ({ args, options }) =>
|
||||
|
||||
Reference in new issue
Block a user