Fork me on GitHub
Joe R. Smith00:12:06

Lacinia usage question: I've been writing specs for input objects in order to: 1. specify more precise constaints than expressible w/ GraphQL's types and 2. to generate input data for tests. This is suboptimal though b/c I end up validating input twice and, since I'm using the specs as input generators I end up duplicating the graphql schema in the spec definitions completely. Due to the inevitable cyclic dependency, I cannot reference the compiled lacinia schema from the spec namespace that is need in the resolvers (for conforming/validating input). How do others generate input and add additional input constraints?


@solussd I used Kafka with avro schema's for the input, using specific generated Java classes. So I didn't need additional constraints on the input.


@solussd Serene ( will generate specs for your schema (including input types) and allows extension. I think it will solve the issues you're facing.

Joe R. Smith15:12:16

Thanks Dom, I’ll check it out.

👍 4

how do you debug this error from a lacinia spec ?

Introspection must provide output type for fields.
    at invariant ()
    at getOutputType ()
    at Array.reduce (<anonymous>)
    at keyValMap ()
    at buildFieldDefMap ()
    at fields ()
    at resolveThunk ()
    at defineFieldMap ()
Given (partial spec):

  {:description ""
   :fields {:application_id {:type ID}
            :app_transaction_id {:type ID}
            :borrower_loan_person_id {:type ID}
            :cosigner_loan_person_id {:type ID}
            :student_loan_person_id {:type ID}
            :fulfillment_application_id {:type ID}
            :data_save_completed {:type Boolean}
            :borrower_is_age_of_majority {:type Boolean}
            :cosigner_is_age_of_majority {:type Boolean}
            :is_no_ssn {:type Boolean}
            :is_assigned_admin_id {:type Boolean}}}
  {:description ""
   :fields {:application_started_user_type {:type String}
            :request_user_type {:type String}
            :validation_group_list {:type (list String)}}}

 {:save_application_data {:type :ApplicationDataOutput
                          :description "Save application data"
                          :args {:data {:type :ApplicationDataInput}}
                          :resolve :mutation/save-application-data}}
Rootcause seems to be save_application_data mutation


I was able to resolve this: part of the schema included an object with a field of input type; turns out you can’t reuse input types in objects (output type).


This is something we should probably have Lacinia validate during schema compilation.


That would be great, yes.