(
lines: string[],
schema: JSONSchema7,
rawExpr: string,
ctx: GoCodegenCtx,
indent: string,
varPrefix: string
)
| 1313 | } |
| 1314 | |
| 1315 | function pushGoJSONSchemaMatchLines( |
| 1316 | lines: string[], |
| 1317 | schema: JSONSchema7, |
| 1318 | rawExpr: string, |
| 1319 | ctx: GoCodegenCtx, |
| 1320 | indent: string, |
| 1321 | varPrefix: string |
| 1322 | ): void { |
| 1323 | const objectSchema = goObjectSchemaForMatch(schema, ctx); |
| 1324 | if (objectSchema) { |
| 1325 | const objectVar = `${varPrefix}Object`; |
| 1326 | lines.push(`${indent}var ${objectVar} map[string]json.RawMessage`); |
| 1327 | lines.push(`${indent}if err := json.Unmarshal(${rawExpr}, &${objectVar}); err != nil {`); |
| 1328 | lines.push(`${indent}\treturn false`); |
| 1329 | lines.push(`${indent}}`); |
| 1330 | pushGoJSONObjectMatchLines(lines, objectSchema, objectVar, ctx, indent, varPrefix); |
| 1331 | return; |
| 1332 | } |
| 1333 | |
| 1334 | const stringValues = goStringEnumValues(schema, ctx); |
| 1335 | if (stringValues) { |
| 1336 | pushGoJSONStringMatchLines(lines, rawExpr, stringValues, indent, varPrefix); |
| 1337 | } |
| 1338 | } |
| 1339 | |
| 1340 | function goVariantMatchFuncName(variantTypeName: string): string { |
| 1341 | return goUnexportedFunctionName("matches", variantTypeName); |
no test coverage detected
searching dependent graphs…