smart-data-models/data-models

Few corrections in ngsi-ld_generator_keyvalues_v0.93.py

dpatil-fw opened this issue · 1 comments

  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)}
  1. 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"}}

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