Restricting Queries to specific Fields

I don’t get my head arround, restricting Queries to specific fields. This is what I tried, but since the parameters are no inputs in a Query, this doesn’t work.

Is there any way to archive this?

type Vertrag {
  id: ID! 
  name: String!
  profitabelBis: Float!
}

type Verhandlungsrahmen {
	id: ID!
	rabattVon: Float!
	rabattBis: Float!
}

type Query {
    createVertrag(
        name: String!
        preis: Float!
        verhandlungsrahmen: VerhandlungsrahmenInput!
    ): Task @bb_resolver(
            _type: INSERT
            _object: Vertrag
            _fields: {
                name: "$name"
                preis: "$preis"
                verhandlungsrahmen: { id: "$verhandlungsrahmen.$id" }
            }
        )
}

Hi Raphael,

You just need to add a _select specifier for the nested field:

createVertrag(
        name: String!
        preis: Float!
        verhandlungsrahmen: VerhandlungsrahmenInput!
    ): Task @bb_resolver(
            _type: INSERT_NESTED
            _object: Vertrag
            _fields: {
                name: "$name"
                preis: "$preis"
                verhandlungsrahmen: { 
                   _select: true
                    id: "$verhandlungsrahmen.$id" 
                }
            }
        )

Sorry Raphael, just had another look. With the objects you’ve set up, there is no field linking the Vertrag object and the Verhandlungsrahmen. Was that intentional? Otherwise, you might describe the relationship between them like this maybe:

type Vertrag {
  id: ID! 
  name: String!
  profitabelBis: Float!
  verhandlungsrahmen: Verhandlungsrahmen
}

type Verhandlungsrahmen {
	id: ID!
	rabattVon: Float!
	rabattBis: Float!
}

Yes, that is what I meant. We actually modelled the relation in another version of this File.