(definitionName: string, schema: JSONSchema7, ctx: GoCodegenCtx)
| 2965 | } |
| 2966 | |
| 2967 | function emitGoRpcDefinition(definitionName: string, schema: JSONSchema7, ctx: GoCodegenCtx): string { |
| 2968 | const typeName = goDefinitionName(definitionName); |
| 2969 | const effectiveSchema = resolveObjectSchema(schema, ctx.definitions) ?? resolveSchema(schema, ctx.definitions) ?? schema; |
| 2970 | |
| 2971 | if (isStringEnumDefinition(effectiveSchema)) { |
| 2972 | getOrCreateGoEnum(typeName, effectiveSchema.enum, ctx, effectiveSchema.description, getEnumValueDescriptions(effectiveSchema), isSchemaDeprecated(effectiveSchema), isSchemaExperimental(effectiveSchema)); |
| 2973 | return typeName; |
| 2974 | } |
| 2975 | |
| 2976 | if (isNamedGoObjectSchema(effectiveSchema)) { |
| 2977 | emitGoStruct(typeName, effectiveSchema, ctx); |
| 2978 | return typeName; |
| 2979 | } |
| 2980 | |
| 2981 | const unionMembers = goNonNullUnionMembers(effectiveSchema); |
| 2982 | if (unionMembers.length > 0) { |
| 2983 | const plan = planGoUnion(typeName, effectiveSchema, ctx, true); |
| 2984 | if (plan) emitGoUnionPlan(plan, ctx); |
| 2985 | return typeName; |
| 2986 | } |
| 2987 | |
| 2988 | emitGoAlias(typeName, effectiveSchema, ctx); |
| 2989 | return typeName; |
| 2990 | } |
| 2991 | |
| 2992 | interface GoGeneratedTypeCode { |
| 2993 | typeCode: string; |
no test coverage detected
searching dependent graphs…