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

Query Context Source Registration behaviour is incorrect #1315

Open
jason-fox opened this issue Jan 16, 2025 · 1 comment · May be fixed by #1337
Open

Query Context Source Registration behaviour is incorrect #1315

jason-fox opened this issue Jan 16, 2025 · 1 comment · May be fixed by #1337
Assignees
Labels
csr Relates to context sources (registrations) API feature New feature or request

Comments

@jason-fox
Copy link
Contributor

I have created a registration as shown, and I then want to discover it:

curl -L 'http://localhost:1026/ngsi-ld/v1/csourceRegistrations/' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Content-Type: application/json' \
-d '{
    "type": "ContextSourceRegistration",
    "information": [
        {
            "entities": [
                {
                    "type": "AgriParcel"
                },
                {
                    "type": "Animal"
                }
            ]
        }
    ],
    "mode": "redirect",
    "management": {
        "timeout": 1000
    },
    "operations": [
        "redirectionOps"
    ],
    "endpoint": "http://farmer"
}'

Making the request:

curl -L 'http://localhost:1026/ngsi-ld/v1/csourceRegistrations/?type=Animal' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'

Results in the following error: ❌

{
    "type": "https://uri.etsi.org/ngsi-ld/errors/InvalidRequest",
    "title": "The ['local'] parameters are not allowed on this endpoint. Accepted query parameters are 'options', 'count', 'offset', 'limit'. ",
    "status": 400,
    "detail": "If you have difficulty identifying the exact cause of the error, please check the list of some usual causes on https://stellio.readthedocs.io/en/latest/TROUBLESHOOT.html . If the error is still not clear or if you think it is a bug, feel free to open an issue on https://github.com/stellio-hub/stellio-context-broker",
    "instance": "/ngsi-ld/v1/csourceRegistrations"
}

Making the request **without the type succeeds when it should fail ❌

curl -L 'http://localhost:1026/ngsi-ld/v1/csourceRegistrations/' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'

Both of these are wrong according to 5.10.2 and table 6.8.3.2-1

5.10.2.4 Behaviour

-Execute the behaviour defined in clause 5.5.4 on JSON-LD validation.

  • At least one of the following input data shall be provided:
    a) selector of Entity Types;
    b) list of Attribute names;
    c) NGSI-LD Query;
    d) NGSI-LD GeoQuery.

If none of them is provided, then an error of type BadRequestData shall be raised (too wide query)

Table 6.8.3.2-1: Query parameters

At least one among: type, attrs, q, or georel shall be present.

@bobeal
Copy link
Member

bobeal commented Jan 18, 2025

Yes, Query Context Source Registrations is still very partially implemented (https://docs.google.com/spreadsheets/d/18tq0_PZFl5WCfYUElcdI6M3Vlin4hP-M/edit?gid=290842468#gid=290842468), we'll add more as we progress in the implementation of the dist ops.

@thomasBousselin at least allow for id, type and idPattern which are already internally implemented (I actually thought it was).

@bobeal bobeal added feature New feature or request csr Relates to context sources (registrations) API labels Jan 18, 2025
@bobeal bobeal added this to Roadmap Jan 18, 2025
@github-project-automation github-project-automation bot moved this to Short term in Roadmap Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csr Relates to context sources (registrations) API feature New feature or request
Projects
Status: Short term
3 participants