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

GET /ngsi-ld/v1/types returns an empty JSONarray when EntityTypeList is empty #732

Closed
fisuda opened this issue Feb 27, 2021 · 2 comments
Closed

Comments

@fisuda
Copy link

fisuda commented Feb 27, 2021

NGSI-LD spec specifies that GET /ngsi-ld/v1/types returns a EntityTypeList type, unless details=true is specified.
But it returns an empty JSONarray when EntityTypeList is empty.

$ curl orion-ld:1026/ngsi-ld/v1/types
[]

I think that it should returns an empty JSONobject or an JSONobject including a empty typeList as shown:

{}

or

{
  "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
  "id": "urn:ngsi-ld:EntityTypeList:b6c79274-78c4-11eb-a948-0242ac12000f",
  "type": "EntityTypeList",
  "typeList": []
}

I tested this using Orion 0.6.1.

$ curl orion-ld:1026/version
{
  "orionld version": "0.6.1",
  "orion version":   "1.15.0-next",
  "uptime":          "0 d, 0 h, 12 m, 26 s",
  "git_hash":        "nogitversion",
  "compile_time":    "Thu Jan 28 10:52:23 UTC 2021",
  "compiled_by":     "root",
  "compiled_in":     "buildkitsandbox",
  "release_date":    "Thu Jan 28 10:52:23 UTC 2021",
  "doc":             "https://fiware-orion.readthedocs.org/en/master/"
}

$ curl orion-ld:1026/ngsi-ld/v1/types | jq .
{
  "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
  "id": "urn:ngsi-ld:EntityTypeList:b6c79274-78c4-11eb-a948-0242ac12000f",
  "type": "EntityTypeList",
  "typeList": [
    "https://uri.fiware.org/ns/data-models#TemperatureSensor"
  ]
}
@kzangeli kzangeli self-assigned this Feb 27, 2021
@kzangeli kzangeli added the bug Something isn't working label Feb 27, 2021
@kzangeli
Copy link
Collaborator

Yes, you are probably right. I will look into this.
The response type of GET /types was recently changed and while the normal case (some type found) has been changed to return what the NGSI-LD API spec now states, this corner-case was probably forgotten.

I promise to look into this and if we (well, you :)) are right, to fix it ASAP!

Thanks!

kzangeli added a commit that referenced this issue Feb 27, 2021
kzangeli added a commit that referenced this issue Feb 27, 2021
@kzangeli kzangeli added Fixed - needs validation and removed bug Something isn't working labels Feb 27, 2021
@fisuda
Copy link
Author

fisuda commented Feb 27, 2021

I have confirmed that this issue has been fixed. I appreciate your prompt response.

$ curl -s orion-ld:1026/ngsi-ld/v1/types | jq .
{
  "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",
  "id": "urn:ngsi-ld:EntityTypeList:80adecbc-7944-11eb-9ae6-0242ac150012",
  "type": "EntityTypeList",
  "typeList": []
}

$ curl -s orion-ld:1026/version
{
  "orionld version": "post-v0.6",
  "orion version":   "1.15.0-next",
  "uptime":          "0 d, 0 h, 21 m, 27 s",
  "git_hash":        "nogitversion",
  "compile_time":    "Sat Feb 27 12:36:35 UTC 2021",
  "compiled_by":     "root",
  "compiled_in":     "buildkitsandbox",
  "release_date":    "Sat Feb 27 12:36:35 UTC 2021",
  "doc":             "https://fiware-orion.readthedocs.org/en/master/"
}
$ docker images
fiware/orion-ld                          0.7-PRE-71                     d82d77013395   9 hours ago      978MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants