smart-data-models / data-models

Data Models in common use based on real world use-cases. These definitions underpin a digital market of interoperable and replicable smart solutions.
https://smartdatamodels.org/
114 stars 56 forks source link

Few corrections in ngsi-ld_generator_keyvalues_v0.93.py #27

Closed dpatil-fw closed 3 years ago

dpatil-fw commented 3 years ago
  1. payload_interger -> Typo here, please remove additional r

  2. Should the "type": "object" below be "type": "Relationship"

    def payload_relationship(propertyName, dataModel):
    return {"type": "object", "value": fake_uri(propertyName, dataModel)}
  3. Handling email type

Please add the following code to handle emails as well:

        elif payload["type"] == "string" and "format" in keys:
            if payload["format"] == "date-time":
                return payload_date()
            elif payload["format"] == "uri":
                return payload_uri(prop, dataModel)    
      >     elif payload["format"] == "idn-email":
      >         return payload_email()
def payload_email():
    return {"type": "Property", "value" : {"type": "Property", "value": "abc@abc.com"}}
albertoabellagarcia commented 3 years ago

You are right. I've implemented what you mention but for the email, I created a new function for being actually randomly generated. See as version 0.94