noi-techpark / it.bz.opendatahub.databrowser

Explore and navigate through Open Data you need to build your next service.
https://databrowser.opendatahub.com
GNU Affero General Public License v3.0
8 stars 7 forks source link

As an Open Data Hub manager I want the possibility to add new Dataset without getting a validation error, to extend the dataset of the Open Data Hub. #372

Closed sseppi closed 1 year ago

sseppi commented 1 year ago

Testing "Add a record" functionality for the metadata API I got a validation Error while trying to save the new dataset.

As you can see in the screenshot below I get the following error message:

"Required property 'Id' not found in JSON. Path '', line 1, position 878."

Image

The problem seems to be in the ID field that is read only and isn't generated by the API.

gappc commented 1 year ago

@sseppi that seems to be a problem with the ODH, it shouldn't be necessary to provide an ID on dataset creation because it is almost never a good idea to let a user define IDs. @RudiThoeni what is your opinion on this?

RudiThoeni commented 1 year ago

@sseppi, @gappc In the Metadata api i used our long time ago predefined IDs style like.... it.bz.opendatahub.accommodation.lts.room it.bz.opendatahub.article.idm

If we want to have this Type of IDs, maybe i can autogenerate it with at example "com.opendatahub." + odhtype + source For having this i have to set odhtype and source as required.....

But there are cases where this logic does not work at example on it.bz.opendatahub.article we have the dataset for All articles with all sources.....

Another option would be to switch to Autogenerated Ids (GUIDS,UUIDS) or To let the ID be defined by the Editor (In the case of the databrowser i think only a few expert users will edit....)

gappc commented 1 year ago

@RudiThoeni in my opinion the values that are now stored in the Id field should be put into another field (e.g. ApiId), the Id field should be managed by ODH only (a user should not be allowed to define technical IDs).

RudiThoeni commented 1 year ago

could be an option, i will have a look at the metadata api this sprint

RudiThoeni commented 1 year ago

I used the field ApiIdfor storing the Idwe had before and generated random Ids..... so now the Id on insert is generated by ODH However the insert does not work because in the datamodel the fields defined as required are:

ApiVersion,
OdhType,
ApiIdentifier

I saw the field ApiUrl on DataBrowser "Insert", this is an autogenerated field out of ApiVersion, ApiIdentifier and an optional ApiFilter

gappc commented 1 year ago

@RudiThoeni thank you for the changes, here is some feedback based on the TEST environment:

  1. do we need the field ApiId at all, given that we moved to a generated ID field? If the field is not needed anymore, I would remove it (note that the ApiId seems to be a required field)
  2. you mentioned that ApiUrl is generated. At the same time there is an array field PathParam that seems to have the same responsibility, at least it is not clear to me if both fields are needed and which one is used. What happens if the fields contradict each other?
  3. how is ApiUrl autogenerated for paths that point to sub-resources (e.g. /MyNewResource/ID_XYZ/Address)? Do the sub-resource-paths then have to be part of the the ApiIdentifier (e.g. ApiIdentifier = MyNewResource/ID_XYZ/Address)?
  4. what's the reason to have the OdhType field in the MetaData? If it is not strictly needed (at least it is not on the frontend), I would remove it
RudiThoeni commented 1 year ago

Hi

1) This field is not required, Have to check if it is present on the documentation when it is not there we can remove it........it was our old naming convention for the dataset name

2 + 3) Good point, in fact this information is doubled.... At the moment we have the ApiUrl generated out of ApiVersion/ApiIdentifier/(ApiFilter)

On Measuringpoints we have this example you mentioned on 3 it currently is handled this way "PathParam": [ "v1", "Weather", "Measuringpoint" ], "ApiVersion": "v1", "ApiIdentifier": "Weather/Measuringpoint", "ApiUrl": "https://api.tourism.testingmachine.eu/v1/Weather/Measuringpoint"

Now we have to decide which is the better option

What is your opinion about it?

4) Maybe it could be a useful info to know what odhtype the endpoint is returning..... odhtype is always part of the _Meta Info of each record, and used in the Search api..... maybe let's keep it and remove just the Required attribute?

gappc commented 1 year ago

@RudiThoeni thank you for the answers, here are my ideas:

  1. remove anything not necessary, it will simplify our lives down the road ;)

2+3. I'd opt to have PathParams only and no version information at all, because in reality the version information is just a part of the path and is used here as part of a convention - the version could be arbitrarily mapped (e.g. using HTTP headers). Using PathParams only gives us full flexibility and provides a simple mental model

  1. at the moment I see no usage for the OdhType in the frontend and if it's not required sooner or later we have incomplete data. I'd opt to remove it - see also my answer for 1)
RudiThoeni commented 1 year ago

Hi

Ok all fine for me, reducing complexity is always welcome........ i will only check if the old id is not listed somewhere in de docs so we have decided to
Remove Fields

will write down here when done

RudiThoeni commented 1 year ago

I checked, and find nothing regarding to the old Ids, so i will remove the field ApiId However i will have to let OdhType there because at the moment my intern Record Count Update works with this field but i think this is not a problem, i set the field to not required .....

Maybe i can change also the field "ApiFilter": [ "source=noi" ], into a Dictionary like "ApiFilter": { "source": "noi" }, so it is clearer what do you think?

RudiThoeni commented 1 year ago

I deployed on Test

I tried and It is now possible to insert data via databrowser (the passed ApiVersion is ignored, ApiUrl is autogenerated) also i saw the databrowser is missing a few fields (Sources, Output, Apiaccess)

let me know if this changes are ok

gappc commented 1 year ago

Hi @RudiThoeni, thank you for the changes, some of which came a bit as a surprise (see below) ;)

Here is my feedback:

Other points I noted:

Before doing the next round of changes I think it would be a good idea if we had a meeting to discuss the open topics, what do you say?

RudiThoeni commented 1 year ago

Thank you for your feedback,

sseppi commented 1 year ago

Hi all, thank you all for the discussion and the changes you did.

I take the opportunity to notify that, in the next months we will integrate also the information about datasets of other domains in the Metadata API. This probably will lead to the need to extend and improve the metadata API accordingly to the needs that will emerge.

For this reason I suggest that in this iteration we do the changes we need to solve the bug/missing feature and then we create a dedicated issue/epic to discuss, plan and implement the future changes and optimization of the metadata API.

gappc commented 1 year ago

@RudiThoeni thank you for the changes, anything works. The nullable Id came to my mind as I was looking at the API spec, don't worry, no further requests from my side about that ;)

@sseppi agreed :+1:

sseppi commented 1 year ago

OK! Super. @gappc If I'm not wrong, we are ready to put this issue in ToDo lane.

gappc commented 1 year ago

@sseppi the "Add new" functionality of the Data Browser is tested and works for some endpoints (e.g. MetaData API), but it was not tested on all endpoints. I'm not sure if this issue refers to the MetaData endpoint only, or to all endpoints.

sseppi commented 1 year ago

@gappc this issue was referring only to the MetaData API, I will do a double-check test for the functionality on this endpoint and, if everything OK, close this issue.

Then I will organize a test af the "Add new" functionality on all other enpoint and, in case of need, open a dedicated issue for the other enpoints.

sseppi commented 1 year ago

@gappc I like it!

@pkritzinger and @Mazzolintis what do you think?

pkritzinger commented 1 year ago

@sseppi I honestly lost track regarding this issue. Can we have a look at it together tomorrow pls?

sseppi commented 1 year ago

OK, let see this issue all together tomorrow