Skip to content

Commit

Permalink
Merge pull request #2 from valdio/dev
Browse files Browse the repository at this point in the history
feature/ chained inheritances
  • Loading branch information
valdio authored Apr 30, 2023
2 parents 6c56a36 + e27b4cc commit 28c971f
Show file tree
Hide file tree
Showing 6 changed files with 542 additions and 10 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Use the `inherits` directive to define a type or input object that inherits from
// <!-- Declare directive -->
directive @inherits(type: String!) on OBJECT | INPUT_OBJECT

// --------------------------------------------------------

// <!-- GraphQLObjectType example -->
type Pet {
id: ID
Expand All @@ -51,6 +53,8 @@ Use the `inherits` directive to define a type or input object that inherits from
breed: String
}

// --------------------------------------------------------

// <!-- GraphQLInputObjectType example -->
input PetInput {
name: String
Expand All @@ -60,4 +64,36 @@ Use the `inherits` directive to define a type or input object that inherits from
input DogInput @inherits(type: "PetInput") {
breed: String
}

// --------------------------------------------------------

// <!-- Cross types are also permitted. -->
// For example from Object to Input type:

type UserBase {
name: String
age: Int
}
input UserInput @inherits(type: "UserBase") {
email: String!
}

```

#### Note!

> Circular inheritances are not supported and will cause an `RangeError: Maximum call stack size exceeded`.
### [License](./LICENSE)

```
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
Loading

0 comments on commit 28c971f

Please sign in to comment.