MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseJsonLike

Function parseJsonLike

packages/plugins/openapi/src/sdk/parse.ts:131–138  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

129const parseJsonText = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
130
131const parseJsonLike = (text: string): Effect.Effect<unknown, unknown> => {
132 const parseYaml = Effect.try({
133 try: () => parseYamlDocument(text, { json: true, schema: JSON_SCHEMA }) as unknown,
134 catch: () => "YamlParseFailed" as const,
135 });
136 if (!text.startsWith("{") && !text.startsWith("[")) return parseYaml;
137 return parseJsonText(text).pipe(Effect.catch(() => parseYaml));
138};

Callers 1

parseSpecObjectFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected