Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: Fix the path value in the response of error reply of replace_metadata #7769

Closed
codingkarthik opened this issue Nov 3, 2021 · 1 comment
Assignees
Labels
k/bug Something isn't working

Comments

@codingkarthik
Copy link
Contributor

Version Information

Server Version:
CLI Version (for CLI related issue):

Environment

What is the expected behaviour?

Consider the following metadata:

{
    "type": "replace_metadata",
    "version": 2,
    "args": {
        "allow_inconsistent_metadata": true,
        "metadata": {
            "inherited_roles": [],
            "sources": [
                {
                    "configuration": {
                        "connection_info": {
                            "database_url": {
                                "from_env": "HASURA_GRAPHQL_DATABASE_URL"
                            },
                            "isolation_level": "read-committed",
                            "pool_settings": {
                                "connection_lifetime": 600,
                                "idle_timeout": 180,
                                "max_connections": 50,
                                "retries": 1
                            },
                            "use_prepared_statements": true
                        }
                    },
                    "kind": "postgres",
                    "name": "default",
                    "tables": [   
                        
                    ]
                },
                {
                    "configuration": {
                        "connection_info": {
                            "database_url": "<REDACTED>",
                            "isolation_level": "read-committed",
                            "use_prepared_statements": false
                        }
                    },
                    "kind": "postgres",
                    "name": "db3",
                    "tables": [
                        {
                            "table": {
                                "name": "check",
                                "schema": "public"
                            }
                        },
                        {
                            "table": {
                                "names": "t1d",   <---------- `names` instead of `name`
                                "schema": "public"
                            }
                        },
                        {
                            "table": {
                                "name": "t2d",
                                "schema": "public"
                            }
                        }
                    ]
                }
            ],
            "version": 3
        }
    }
}

While trying to replace this metadata in the graphql-engine, we get the following response:

{
  "path": "$.args.metadata.tables[1].table",
  "error": "key \"name\" not found",
  "code": "parse-failed"
}

the path here is incorrect, as the correct JSON path is $.args.metadata.sources[0].tables[1].table object and the same should be returned in the response.

Keywords

What is the current behaviour?

How to reproduce the issue?

Screenshots or Screencast

Please provide any traces or logs that could help here.

Any possible solutions?

Can you identify the location in the source code where the problem exists?

If the bug is confirmed, would you be willing to submit a PR?

@codingkarthik codingkarthik added the k/bug Something isn't working label Nov 3, 2021
@ecthiender ecthiender self-assigned this Nov 10, 2021
@ecthiender
Copy link
Member

Fixed via b3464c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants