data-models
data-models copied to clipboard
Error in "location" when generating a random example
When I generate a random example of a WasteContainer entity using ngsi_ld_example_generator
from pysmartdatamodels
, the type of "location" is set to "Property" instead of "GeoProperty"
That's very good point, let us check it out
did you use it in pysmartdatamodels package or in the online service?
by the comment I guess it is in pysmartdatamodels
yes, I was using the pysmartdatamodels package
Your error could be possible if you are running and old version of the pysmartdatamodels, you have two options:
- run the function sdm.update_data(). This function retrieves last version of the data about the data models that possibly fixes your need (takes some minutes, be patient, it downloads the full database)
- update to the last version 0.7.1 of the package
Let me suggest you to make a test with this code before and after updating with 1) or 2) . Possibly the error would appear before updating and will disappear afterwards.
from pysmartdatamodels import pysmartdatamodels as sdm
result = sdm.ngsi_ld_example_generator("https://raw.githubusercontent.com/smart-data-models/dataModel.WasteManagement/master/WasteContainer/schema.json") print(result) with open("payload.json", "w") as file: json.dump(result, file, indent=2)