Edit page

Interfaces

Are kind of like mixins, but their existence is exposed on the GraphQL so they're helpful when you have collections of entities returned from a field/Query and these have multiple different types, but they have a common set of fields. Interfaces are slighly more convenient for your API consumers than Unions.

THEN you can query your schema like this:

NOTE: All your interfaces are stored globally in a singleton interfaceClassesSet. If you need to build more than one schema, it may be wise do clear() this Set after you compile each schema to avoid having all the interfaces in all of your schemas. Import it like this: import {interfaceClassesSet} from decapi