diff --git a/src/main/java/org/spdx/tools/schema/OwlToJsonSchema.java b/src/main/java/org/spdx/tools/schema/OwlToJsonSchema.java index 7e3b2b0..62007bc 100644 --- a/src/main/java/org/spdx/tools/schema/OwlToJsonSchema.java +++ b/src/main/java/org/spdx/tools/schema/OwlToJsonSchema.java @@ -93,7 +93,8 @@ public ObjectNode convertToJsonSchema() { ExtendedIterator ontologyIter = model.listOntologies(); if (ontologyIter.hasNext()) { Ontology ont = ontologyIter.next(); - String ontologyUri = ont.getURI(); + String version = ont.getVersionInfo(); + String ontologyUri = version == null ? ont.getURI() : ont.getURI() + "/" + version; if (Objects.nonNull(ontologyUri)) { root.put("$id", ontologyUri); } @@ -231,6 +232,10 @@ private void addClassProperties(OntClass spdxClass, ObjectNode jsonSchemaPropert jsonSchemaProperties.set(MultiFormatStore.propertyNameToCollectionPropertyName( checkConvertRenamedPropertyName(property.getLocalName())), deriveListPropertySchema(property, restrictions)); + if (!restrictions.isOptional() || restrictions.getMinCardinality() > 0) { + required.add(MultiFormatStore.propertyNameToCollectionPropertyName( + checkConvertRenamedPropertyName(property.getLocalName()))); + } } else { jsonSchemaProperties.set(checkConvertRenamedPropertyName(property.getLocalName()), derivePropertySchema(property, restrictions)); if (!restrictions.isOptional()) { @@ -322,9 +327,9 @@ private ObjectNode derivePropertySchema(OntProperty property, PropertyRestrictio // check for AnyLicenseInfo - these are strings with the exception of the extractedLicensingInfos which are the actual license description JsonNode description = propertySchema.get("description"); if (Objects.isNull(description)) { - propertySchema.put("description", "License expression"); + propertySchema.put("description", "License expression. See SPDX Annex D for the license expression syntax."); } else { - propertySchema.put("description", "License expression for "+checkConvertRenamedPropertyName(property.getLocalName())+". "+description.asText()); + propertySchema.put("description", "License expression for "+checkConvertRenamedPropertyName(property.getLocalName())+". See SPDX Annex D for the license expression syntax. "+description.asText()); } propertySchema.put(JSON_RESTRICTION_TYPE, JSON_TYPE_STRING); } else if (Objects.nonNull(clazz) && SpdxElement.class.isAssignableFrom(clazz)) {