Giter VIP home page Giter VIP logo

Comments (4)

seantleonard avatar seantleonard commented on August 25, 2024

Require user to provide values for default columns in the request. and add explicit error messaging if not provided so user knows what to do to mitigate HTTP 400 bad request/ GraphQL equivalent error message.

from data-api-builder.

seantleonard avatar seantleonard commented on August 25, 2024

@severussundar please update expectations and description for this feature.

from data-api-builder.

severussundar avatar severussundar commented on August 25, 2024

Relationship fields when backed by default values will be required to be provided by the user.

Consider two entities: User_AutogenToNonAutogenRelationshipColumn and UserProfile

Entity User_AutogenToNonAutogenRelationshipColumn has the following relationship defined with entity UserProfile.

"UserProfile_AutogenToNonAutogenRelationshipColumn": {
          "cardinality": "one",
          "target.entity": "UserProfile",
          "source.fields": [
            "userid",
            "username"
          ],
          "target.fields": [
            "userid",
            "username"
          ],
          "linking.source.fields": [],
          "linking.target.fields": []
        }

Relationship Fields

User_AutogenToNonAutogenRelationshipColumn: userid, username
UserProfile: userid, username. userid column has a default value of 1.

Multiple Create request:
Mutation Request

mutation {
  createUser_AutogenToNonAutogenRelationshipColumn(
    item: {
      email: "[email protected]"
      UserProfile_AutogenToNonAutogenRelationshipColumn: {
        profilepictureurl: "https://example.com/profiles/alice"
        username: "Alice"
      }
    }
  ) {
    userid
    username
    email
    UserProfile_AutogenToNonAutogenRelationshipColumn {
      profileid
      username
      userid
      profilepictureurl
    }
  }
}

The above mutation request does not provide an input for userid field for the relationship field UserProfile_AutogenToNonAutogenRelationshipColumn. It only provides input for username. When executed this request, it will error out with the following error message.

Error Message:
Error Message

{
  "errors": [
    {
      "message": "Neither source entity: User_AutogenToNonAutogenRelationshipColumn nor the target entity: UserProfile for the relationship: UserProfile_AutogenToNonAutogenRelationshipColumn at level: 1 provide sufficient data to perform a multiple-create (related insertion) on the entities.",
      "extensions": {
        "code": "BadRequest"
      }
    }
  ],
  "data": {
    "createUser_AutogenToNonAutogenRelationshipColumn": null
  }
}

from data-api-builder.

Aniruddh25 avatar Aniruddh25 commented on August 25, 2024

Require values to be provided even for columns which have defaults to determine referencing and referenced entities.

from data-api-builder.

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.