Skip to content

Wrong service type error #680

Closed
Closed

Description

@pmbrull

If we create a dashboardService as follows:

{
  "name": "sample_superset",
  "serviceType": "Superset",
  "description": "Superset Service",
  "dashboardUrl": "http://localhost:8088",
  "username": "admin",
  "password": "admin"
}

And the following Chart based on this service:

{
  "chartType": "Line",
  "chartUrl": "http://example.com",
  "description": "string",
  "displayName": "string",
  "name": "random",
  "service": {
    "id": "f8d5d33e-bcaa-45cc-a13c-af9b083b9faf",
    "type": "DashboardService" <- note the typo here, should be dashboardService
  }
}

We get

> http POST http://localhost:8585/api/v1/charts < localtests/chart.json
HTTP/1.1 404 Not Found
Content-Length: 63
Content-Type: application/json
Date: Tue, 05 Oct 2021 19:49:26 GMT

{
    "code": 404,
    "message": "Entity type DashboardService not found"
}

The issue here is that if we fix the mayus typo and try to POST again, we get:

> http POST http://localhost:8585/api/v1/charts < localtests/chart.json
HTTP/1.1 409 Conflict
Content-Length: 46
Content-Type: application/json
Date: Tue, 05 Oct 2021 19:49:33 GMT

{
    "code": 409,
    "message": "Entity already exists"
}

So we need to PUT as the data is already created.

I checked this as well with the Dashboard <> Chart reference, and the issue persists. Note the error message saying that the Entity type is not found, instead of

{
    "code": 400,
    "message": "Invalid service type dashboard for the chart"
}

Thanks

Activity

  1. self-assigned this
    on Oct 5, 2021
  2. added
    bug
    on Oct 5, 2021
  3. harshach commented on Oct 5, 2021

    @harshach
    Collaborator

    Thanks for finding the bug @pmbrull

  4. added a commit that references this issue on Oct 6, 2021
    d8b28e2
  5. harshach commented on Oct 6, 2021

    @harshach
    Collaborator

    @pmbrull issue was we are ignoring the case serviceType during the creation of entity but in adding href we are checking the case with switch. I made it consistent across the checks . Please add your review #683

  6. pmbrull commented on Oct 6, 2021

    @pmbrull
    MemberAuthor

    Amazing nice catch, thanks!

  7. added a commit that references this issue on Oct 6, 2021
    96001ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions