| 163 | |
| 164 | /** Format a type ref back to GraphQL type notation (e.g. "[String!]!") */ |
| 165 | const formatTypeRef = (ref: IntrospectionTypeRef): string => |
| 166 | Match.value(ref.kind).pipe( |
| 167 | Match.when("NON_NULL", () => (ref.ofType ? `${formatTypeRef(ref.ofType)}!` : "Unknown!")), |
| 168 | Match.when("LIST", () => (ref.ofType ? `[${formatTypeRef(ref.ofType)}]` : "[Unknown]")), |
| 169 | Match.option, |
| 170 | Option.getOrElse(() => ref.name ?? "Unknown"), |
| 171 | ); |
| 172 | |
| 173 | // --------------------------------------------------------------------------- |
| 174 | // Extract fields from schema |