Variable META_SCHEMA_STRConst

META_SCHEMA_STR: "$schema" = '$schema'

Rules

  1. Schema must define a top level credentialSubject field for the subject, and it can be an object or array of object
  2. Credential status if defined must be present as credentialStatus field.
  3. Any top level keys in the schema JSON can be created Some example schemas

{ '$schema': 'http://json-schema.org/draft-07/schema#', type: 'object', properties: { credentialSubject: { type: 'object', properties: { fname: { type: 'string' }, lname: { type: 'string' }, email: { type: 'string' }, SSN: { '$ref': '#/definitions/encryptableString' }, userId: { '$ref': '#/definitions/encryptableCompString' }, country: { type: 'string' }, city: { type: 'string' }, timeOfBirth: { type: 'integer', minimum: 0 }, height: { type: 'number', minimum: 0, multipleOf: 0.1 }, weight: { type: 'number', minimum: 0, multipleOf: 0.1 }, BMI: { type: 'number', minimum: 0, multipleOf: 0.01 }, score: { type: 'number', minimum: -100, multipleOf: 0.1 }, secret: { type: 'string' } } } }, definitions: { encryptableString: { type: 'string' }, encryptableCompString: { type: 'string' } } }

{ '$schema': 'http://json-schema.org/draft-07/schema#', type: 'object', properties: { credentialSubject: { type: 'object', properties: { fname: { type: 'string' }, lname: { type: 'string' }, sensitive: { type: 'object', properties: { very: { type: 'object', properties: { secret: { type: 'string' } } }, email: { type: 'string' }, phone: { type: 'string' }, SSN: { '$ref': '#/definitions/encryptableString' } } }, lessSensitive: { type: 'object', properties: { location: { type: 'object', properties: { country: { type: 'string' }, city: { type: 'string' } } }, department: { type: 'object', properties: { name: { type: 'string' }, location: { type: 'object', properties: { name: { type: 'string' }, geo: { type: 'object', properties: { lat: { type: 'number', minimum: -90, multipleOf: 0.001 }, long: { type: 'number', minimum: -180, multipleOf: 0.001 } } } } } } } } }, rank: { type: 'integer', minimum: 0 } } }, credentialStatus: { type: 'object', properties: { id: { type: 'string' }, type: { type: 'string' }, revocationCheck: { type: 'string' }, revocationId: { type: 'string' } } } }, definitions: { encryptableString: { type: 'string' }, encryptableCompString: { type: 'string' } } }

{ '$schema': 'http://json-schema.org/draft-07/schema#', type: 'object', properties: { credentialSubject: { type: 'array', items: [ { type: 'object', properties: { name: { type: 'string' }, location: { type: 'object', properties: { name: { type: 'string' }, geo: { type: 'object', properties: { lat: { type: 'number', minimum: -90, multipleOf: 0.001 }, long: { type: 'number', minimum: -180, multipleOf: 0.001 } } } } } } }, { type: 'object', properties: { name: { type: 'string' }, location: { type: 'object', properties: { name: { type: 'string' }, geo: { type: 'object', properties: { lat: { type: 'number', minimum: -90, multipleOf: 0.001 }, long: { type: 'number', minimum: -180, multipleOf: 0.001 } } } } } } }, { type: 'object', properties: { name: { type: 'string' }, location: { type: 'object', properties: { name: { type: 'string' }, geo: { type: 'object', properties: { lat: { type: 'number', minimum: -90, multipleOf: 0.001 }, long: { type: 'number', minimum: -180, multipleOf: 0.001 } } } } } } } ] } }, definitions: { encryptableString: { type: 'string' }, encryptableCompString: { type: 'string' } } }

{ '$schema': 'http://json-schema.org/draft-07/schema#', type: 'object', properties: { credentialSubject: { type: 'array', items: [ { type: 'object', properties: { name: { type: 'string' }, location: { type: 'object', properties: { name: { type: 'string' }, geo: { type: 'object', properties: { lat: { type: 'number', minimum: -90, multipleOf: 0.001 }, long: { type: 'number', minimum: -180, multipleOf: 0.001 } } } } } } }, { type: 'object', properties: { name: { type: 'string' }, location: { type: 'object', properties: { name: { type: 'string' }, geo: { type: 'object', properties: { lat: { type: 'number', minimum: -90, multipleOf: 0.001 }, long: { type: 'number', minimum: -180, multipleOf: 0.001 } } } } } } }, { type: 'object', properties: { name: { type: 'string' }, location: { type: 'object', properties: { name: { type: 'string' }, geo: { type: 'object', properties: { lat: { type: 'number', minimum: -90, multipleOf: 0.001 }, long: { type: 'number', minimum: -180, multipleOf: 0.001 } } } } } } } ] }, issuer: { type: 'object', properties: { name: { type: 'string' }, desc: { type: 'string' }, logo: { type: 'string' } } }, issuanceDate: { type: 'integer', minimum: 0 }, expirationDate: { type: 'integer', minimum: 0 } }, definitions: { encryptableString: { type: 'string' }, encryptableCompString: { type: 'string' } } }