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

Function parseJsonLike

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

Source from the content-addressed store, hash-verified

206const parseJsonText = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
207
208const parseJsonLike = (text: string): Effect.Effect<unknown, unknown> => {
209 const parseYaml = Effect.try({
210 try: () => parseYamlDocument(text, { json: true, schema: JSON_SCHEMA }) as unknown,
211 catch: () => "YamlParseFailed" as const,
212 });
213 if (!text.startsWith("{") && !text.startsWith("[")) return parseYaml;
214 return parseJsonText(text).pipe(Effect.catch(() => parseYaml));
215};

Callers 1

parseSpecObjectFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected