graphql-hive / graphql-hive/SOFA

OpenAPI: support for union and interface types

Open
#690 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.1k
Forks
91
Avg merge
5h 10m
Merged PRs (30d)
1

Description

From the example schema:
```gql
union Food = Pizza | Salad

type User {
# ...
favoriteFood: Food!
}
```

The resulting OpenAPI type for `components.schemas.User.properties.favoriteFood` is currently
```json
{
"type": "object"
}
```

Wold be nice to turn it into
```json
{
"oneOf": [
{
"$ref": "#/components/schemas/Pizza"
},
{
"$ref": "#/components/schemas/Salad"
}
]
}
```
and do the same for GraphQL interfaces.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files or tests; begin at the OpenAPI schema generation for User.properties.favoriteFood, where the union currently becomes an object. Trace how GraphQL union and interface members are represented, then verify that both generate oneOf schemas with references to each possible type.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.