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

🐛 Create schema: exception thrown generating error response #2169

Closed
MatMoore opened this issue Nov 1, 2023 · 0 comments · Fixed by #2317
Closed

🐛 Create schema: exception thrown generating error response #2169

MatMoore opened this issue Nov 1, 2023 · 0 comments · Fixed by #2317
Assignees
Labels
bug Something isn't working

Comments

@MatMoore
Copy link
Contributor

MatMoore commented Nov 1, 2023

Describe the bug.

I got an internal server error while passing invalid input to this endpoint

2023-11-01T17:33:43.255+00:00Copy[ERROR] AttributeError: 'DataProductSchema' object has no attribute 'error_traceback'Traceback (most recent call last):  File "/var/task/create_schema.py", line 179, in handler    error_msg = f"schema for {table_name} has failed validation with the following error: {schema.error_traceback}" [ERROR] AttributeError: 'DataProductSchema' object has no attribute 'error_traceback' Traceback (most recent call last):   File "/var/task/create_schema.py", line 179, in handler     error_msg = f"schema for {table_name} has failed validation with the following error: {schema.error_traceback}"

To Reproduce

I sent a request to the create schema endpoint but forgot to wrap the JSON in a "schema" object.

i.e.

{
  "tableDescription": "",
  "columns": [
    {
      "name": "id",
      "type": "bigint",
      "description": ""
    },
    {
      "name": "status",
      "type": "string",
      "description": ""
    },
    {
      "name": "noms_id",
      "type": "string",
      "description": ""
    },
    {
      "name": "first_name",
      "type": "string",
      "description": ""
    },
    {
      "name": "last_name",
      "type": "string",
      "description": ""
    },
    {
      "name": "date_of_birth",
      "type": "date",
      "description": ""
    },
    {
      "name": "pnc",
      "type": "string",
      "description": ""
    },
    {
      "name": "agy_loc_id",
      "type": "string",
      "description": ""
    },
    {
      "name": "created_date",
      "type": "date",
      "description": ""
    },
    {
      "name": "crn",
      "type": "string",
      "description": ""
    },
    {
      "name": "source_system",
      "type": "string",
      "description": ""
    },
    {
      "name": "ldu_code",
      "type": "string",
      "description": ""
    },
    {
      "name": "probation_area_code",
      "type": "string",
      "description": ""
    },
    {
      "name": "referral_system",
      "type": "string",
      "description": ""
    },
    {
      "name": "tact_type",
      "type": "string",
      "description": ""
    },
    {
      "name": "caseworker",
      "type": "string",
      "description": ""
    },
    {
      "name": "ct_officer",
      "type": "string",
      "description": ""
    },
    {
      "name": "immigration_team_key",
      "type": "string",
      "description": ""
    }
  ]
}

instead of {"schema": {...}}

Expected Behaviour

A 400 response with the validation error

Additional context

No response

@MatMoore MatMoore added bug Something isn't working data-platform-labs labels Nov 1, 2023
@tom-webber tom-webber self-assigned this Nov 9, 2023
@tom-webber tom-webber moved this from 🧐 To Do to 💨 In Progress in Analytical Platform Nov 10, 2023
@tom-webber tom-webber moved this from 💨 In Progress to 👀 In Review in Analytical Platform Nov 10, 2023
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✨ Done ✨ in Analytical Platform Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants