GithubHelp home page GithubHelp logo

Comments (5)

stubailo avatar stubailo commented on April 30, 2024 1

My gosh, look at that endpoint...

from graphql-tools.

helfer avatar helfer commented on April 30, 2024

Removing this wouldn't break graphql-tools. The reason I included that error is because more often than not, a missing resolve function for a non-scalar type indicates a typo or something. I thought it was an acceptable tradeoff to explicitly write resolve functions that just return a property for the cases where you need to pass through to non-scalar types.

How common is this passing through in your code? I'm asking because we could always add an option to turn these errors off, but I want to be sure it's actually something people need.

from graphql-tools.

sethtippetts avatar sethtippetts commented on April 30, 2024

I think an option to use the default resolve function would be amazing!

Currently almost every one of our existing objects does some kind of nesting. We're transitioning a decent sized API from REST to GraphQL. We wanted to add some structure to the flat monolithic Salesforce objects, so the majority of our existing endpoints have 3-4 nested objects that get mapped by our ODM. The worse offender of nested structure is easily our /projects endpoint:

{
  id: 'Id',
  serviceNumber: 'Service__r.Service_Number__c',
  serviceId: 'Service__c',
  solarPhase: 'Solar_Phase__c',
  primaryCad: 'Primary_CAD__c',
  account: 'Account__c',
  contacts: {
    primary: {
      id: 'Account__r.Primary_Contact__r.Id',
      firstName: 'Account__r.Primary_Contact__r.FirstName',
      lastName: 'Account__r.Primary_Contact__r.LastName',
      fullName: 'Account__r.Primary_Contact__r.Name',
      email: 'Account__r.Primary_Contact__r.Email',
      phone: 'Account__r.Primary_Contact__r.Phone',
      mobilePhone: 'Account__r.Primary_Contact__r.MobilePhone',
    },
    secondary: {
      id: 'Account__r.Secondary_Contact__r.Id',
      firstName: 'Account__r.Secondary_Contact__r.FirstName',
      lastName: 'Account__r.Secondary_Contact__r.LastName',
      fullName: 'Account__r.Secondary_Contact__r.Name',
      email: 'Account__r.Secondary_Contact__r.Email',
      phone: 'Account__r.Secondary_Contact__r.Phone',
      mobilePhone: 'Account__r.Secondary_Contact__r.MobilePhone',
    },
  },
  meta: {
    assignedRepId: 'Opportunity__r.Sales_Credit__c',
    created: 'CreatedDate',
    updated: 'LastModifiedDate',
    campaign: 'Opportunity__r.CampaignId',
  },
  status: {
    hibernated: 'Hibernate__c',
    contractVerified: 'Customer_Agreement_Approved__c',
    active: 'Status__c',
    hoa: 'Opportunity__r.Solar_Have_an_HOA__c',
    installed: 'Installation_Complete__c',
    commissioned: 'Start_Billing__c',
    paymentInfo: 'Service__r.Billing_Account__r.Zuora__PaymentMethod_Type__c',
    billingRecord: 'Service__r.Billing_Account__c',
  },
  utilityProvider: {
    name: 'Opportunity__r.Solar_Utility_Provider__r.Name',
    rate: 'Primary_CAD__r.Current_Annual_Energy_Consumption__c'
  },
  address: {
    street: 'Service__r.Service_Address_1__c',
    street2: 'Service__r.Service_Address_2__c',
    city: 'Service__r.Service_City__c',
    state: 'Service__r.Service_State__c',
    zip: 'Service__r.Service_Zip_Code__c',
    country: 'Service__r.Service_Country__c',
  },
  date: {
    service: {
      created: 'Service__r.CreatedDate'
    },
    opportunity: {
      created: 'Opportunity__r.CreatedDate',
    },
    account: {
      created: 'Account__r.CreatedDate',
    },
    paymentMethod_collected: 'Payment_Method_Collected_On__c',
    creation_complete: 'Project_Create_Date__c',
    cancel: {
      requested: 'Cancellation_Requested_Date__c',
      complete: 'Cancellation_Date__c',
    }
    notary: {
      requested: 'Solar_Phase__r.Notary_Scheduled_On__c',
      complete: 'Solar_Phase__r.Notary_Complete_Date__c',
      appointment: 'Solar_Phase__r.Notary_Scheduled_For__c',
    },
    siteSurvey: { 
      requested: 'Solar_Phase__r.Site_Survey_Scheduled__c',
      appointment: 'Site_Survey_Scheduled_For__c',
      complete: 'Site_Survey_Complete__c',
      approved: 'Site_Survey_Approved1__c',
    },
    siteSurveyExt: {
      complete: 'Site_Survey_Exterior_Completed__c',
    },
    siteSurveyInt: {
      complete: 'Site_Survey_Interior_Completed__c',
    },
    priorUsage: {
      complete: 'Usage_Completed__c',
    },
    cad: {
      complete: 'Solar_Phase__r.CAD_Design_Complete__c',
    },
    cadAsBuilt: {
      complete: 'Solar_Phase__r.As_Built_CAD_Completed__c',
    },
    cadPre: {
      complete: 'Pre_Design_Complete__c',
    },
    structuralReview: {
      complete: 'Structural_Review_Completed__c',
    },
    corporateCheck: {
      complete: 'Customer_Agreement_Approved__c',
    },
    permit: {
      requested: 'Permit_Submitted__c',
      approved: 'Permit_Approved__c',
    },
    hoaAppl: {
      requested: 'HOA_Application_Requested__c',
      approved: 'HOA_Application_Approved__c',
    },
    install: {
      requested: 'Solar_Phase__r.Installation_Scheduled_On__c',
      appointment: 'Installation_Scheduled_For__c',
      complete: 'Installation_Complete__c',
      approved: 'Solar_Phase__r.Installation_Data_Approved__c',
    },
    electrician: {
      requested: 'Solar_Phase__r.Electrician_Scheduled_On__c',
      appointment: 'Electrician_Scheduled_For__c',
      complete: 'Electrician_Complete__c',
      approved: 'Solar_Phase__r.Electrical_Data_Approved__c',
    },
    separateBldgInspection: {
      requested: 'Solar_Phase__r.SB_Inspection_Scheduled_On__c',
      appointment: 'Solar_Phase__r.Building_Inspection_Scheduled_For__c',
      complete: 'Solar_Phase__r.Building_Inspection_Complete__c',
    },
    bldgInspection: {
      requested: 'Solar_Phase__r.Building_Inspection_Requested__c',
      appointment: 'Building_Inspection_Scheduled_For__c',
      complete: 'Building_Inspection_Complete__c',
    },
    elecInspectionPhase: {
      requested: 'Solar_Phase__r.Elec_Inspection_Scheduled_On__c',
      appointment: 'Solar_Phase__r.Electrical_Inspection_Scheduled_For__c',
      complete: 'Solar_Phase__r.Electrical_Inspection_Complete__c',
    },
    elecInspection: {
      requested: 'Solar_Phase__r.Electrical_Inspection_Requested__c',
      appointment: 'Electrical_Inspection_Scheduled_For__c',
      complete: 'Electrical_Inspection_Complete__c',
      approved: 'Electrical_Inspection_Approved__c',
    },
    interconnectionPostinstall: {
      submitted: 'Interconnection_Post_Install_Submitted__c',
    },
    utilityUsage: {
      submitted: 'Usage_Submitted__c',
    },
    utilityBill: {
      submitted: 'Utility_Bill_Submitted__c',
    },
    utility: {
      requested: 'Utility_Interconnection_Requested__c',
      complete: 'Utility_Interconnection_Approved__c',
    },
    startBilling: { 
      complete: 'Start_Billing__c',
    },
    ptoAwarded: { 
      complete: 'PTO_Awarded_Date__c',
    },
    inService: { 
      complete: 'In_Service_Date__c',
    },
    interconnectionPreinstall: {
      requested: 'Interconnection_Pre_Install_Requested__c',
      approved: 'Interconnection_Pre_Install_Approved__c',
    },
    mountInspection: {
      appointment: 'Solar_Phase__r.Mount_Inspection_Scheduled_For__c',
      complete: 'Solar_Phase__r.Mount_Inspection_Complete__c',
    },
    mountInstall: {
      appointment: 'Solar_Phase__r.Mount_Installation_Scheduled_For__c',
      complete: 'Solar_Phase__r.Mount_Installation_Complete__c',
    },
    elecUpgrade: {
      requested: 'Solar_Phase__r.Electrical_Upgrade_Scheduled_On__c',
      appointment: 'Solar_Phase__r.Electrical_Upgrade_Scheduled_For__c',
      complete: 'Solar_Phase__r.Electrical_Upgrade_Complete__c',
    },
    elecUpgradeInspection: {
      requested: 'Solar_Phase__r.Electrical_Upgrade_Inspection_Sched_On__c',
      appointment: 'Solar_Phase__r.Electrical_Upgrade_Inspection_Sched_For__c',
      complete: 'Solar_Phase__r.Electrical_Upgrade_Inspection_Complete__c',
      approved: 'Solar_Phase__r.Electrical_Upgrade_Inspection_Approved__c',
    },    
    corpCancel: {
      request: 'Corp_Idle_Date__c',
      complete: 'Corp_Cancellation_Date__c',
    },
    corpChecked: {
      complete: 'Customer_Agreement_Approved__c',
    },
    cadQa: {
      complete: 'CAD_QA_Complete__c',
    },
    cadCustomer: {
      approved: 'CAD_Customer_Approved__c',
    },
    fin: {
      received: 'FIN_Received__c',
    },
    credit: {
      lastPulled: 'Opportunity__r.Credit_Score_Report__r.Credit_Check_Date__c',
    },
    ppa: {
      verified: 'Transaction_Date__c',
    },
  },
  bank: {
    accountNumber: 'Service__r.Solar_Bank_Account_Number__c',
    routingNumber: 'Service__r.Solar_Bank_Routing_Number__c',
    accountType: 'Service__r.Solar_Bank_Account_Type__c',
  },
  attachments: 'projectId'
}

from graphql-tools.

helfer avatar helfer commented on April 30, 2024

Wow, yeah, I can definitely see why you'd want to turn off the resolver checks for this!

from graphql-tools.

helfer avatar helfer commented on April 30, 2024

I think this is taken care of by #45, so I'm closing the issue.

from graphql-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.