这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rakeshkky
Copy link
Member

Description

What component does this PR affect?

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Requires changes from other components? If yes, please mark the components:

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Related Issue

fix #1352

Solution and Design

  1. Ignore relational insert if null is given or [] for data input field for array relational insert
  2. Ignore insert and return empty mutation response if [] is given for objects input field

Example query :-

      mutation insert_empty_objects {
        insert_author(
          objects: []
        ){
          affected_rows
          returning{
            id
            name
          }
        }
      }

Response:-

{
  "data": {
    "insert_author": {
      "affected_rows": 0,
      "returning": []
    }
  }
}

Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Docs update
  • Community content

Checklist:

  • I have read the contributing guide and my code conforms to the guidelines.
  • This change requires a change in the documentation.
  • I have updated the documentation accordingly.
  • I have added required tests.

@rakeshkky rakeshkky added s/ok-to-merge Status: This pull request can be merged to master c/server Related to server labels Jan 10, 2019
@rakeshkky rakeshkky self-assigned this Jan 10, 2019
@rakeshkky rakeshkky requested a review from 0x777 January 10, 2019 10:13
@hasura-bot
Copy link
Contributor

Review app for commit 3690b64 deployed to Heroku: https://hge-ci-pull-1360.herokuapp.com
Docker image for server: hasura/graphql-engine:pull1360-3690b64

@0x777 0x777 merged commit 1008c08 into hasura:master Jan 11, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-1360.herokuapp.com is deleted

hasura-bot pushed a commit that referenced this pull request Nov 21, 2024
<!-- The PR description should answer 2 important questions: -->

### What
```http
GET /v1/rest/default/Articles/?page[limit]=2&fields[Article]=title,author_id&fields[Author]=first_name&include=Author,Author.articles HTTP/1.1
```
<details>
<summary>Response</summary>

```json
{
  "data": [
    {
      "type": "default_Article",
      "id": "1",
      "attributes": {
        "author_id": 1,
        "title": "The Next 700 Programming Languages"
      },
      "relationships": {
        "Author": {
          "data": {
            "type": "default_Author",
            "id": "2"
          }
        }
      }
    },
    {
      "type": "default_Article",
      "id": "5",
      "attributes": {
        "author_id": 2,
        "title": "Why Functional Programming Matters"
      },
      "relationships": {
        "Author": {
          "data": {
            "type": "default_Author",
            "id": "6"
          }
        }
      }
    }
  ],
  "included": [
    {
      "type": "default_Article",
      "id": "3",
      "attributes": {
        "author_id": 1,
        "title": "The Next 700 Programming Languages"
      }
    },
    {
      "type": "default_Article",
      "id": "4",
      "attributes": {
        "author_id": 1,
        "title": "The Mechanical Evaluation of Expressions"
      }
    },
    {
      "type": "default_Author",
      "id": "2",
      "attributes": {
        "first_name": "Peter"
      },
      "relationships": {
        "articles": {
          "data": [
            {
              "type": "default_Article",
              "id": "3"
            },
            {
              "type": "default_Article",
              "id": "4"
            }
          ]
        }
      }
    },
    {
      "type": "default_Article",
      "id": "7",
      "attributes": {
        "author_id": 2,
        "title": "Why Functional Programming Matters"
      }
    },
    {
      "type": "default_Article",
      "id": "8",
      "attributes": {
        "author_id": 2,
        "title": "The Design And Implementation Of Programming Languages"
      }
    },
    {
      "type": "default_Article",
      "id": "9",
      "attributes": {
        "author_id": 2,
        "title": "Generalizing monads to arrows"
      }
    },
    {
      "type": "default_Author",
      "id": "6",
      "attributes": {
        "first_name": "John"
      },
      "relationships": {
        "articles": {
          "data": [
            {
              "type": "default_Article",
              "id": "7"
            },
            {
              "type": "default_Article",
              "id": "8"
            },
            {
              "type": "default_Article",
              "id": "9"
            }
          ]
        }
      }
    }
  ]
}
```
</details>

<!-- What is this PR trying to accomplish (and why, if it's not
obvious)? -->

<!-- Consider: do we need to add a changelog entry? -->

<!-- Does this PR introduce new validation that might break old builds?
-->

<!-- Consider: do we need to put new checks behind a flag? -->

### How
- Return the `include` parameter in the openapi schema
(`/v1/rest/__schema`).
- Resolve relationship fields in the OpenDD query request. Only local
relationships allowed for now.
- A parser to parse the `include` parameter with nested relationships
and build OpenDD query AST for relationship selection.
- Add tests
<!-- How is it trying to accomplish it (what are the implementation
steps)? -->

V3_GIT_ORIGIN_REV_ID: 516ca9f117f242892146d6026b35266cbaab591d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server s/ok-to-merge Status: This pull request can be merged to master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

accept null for object and array relation insert input

3 participants