Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ public JsonNode getSchemas(
catalogService
.getChartByVersion(catalogId, chartName, version)
.orElseThrow(NotFoundException::new);

if (chart.getConfig() == null) {
return null;
}
return jsonSchemaResolutionService.resolveReferences(chart.getConfig(), user.getRoles());
}

Expand Down Expand Up @@ -531,23 +533,26 @@ private Collection<Object> publishApps(
Map<String, Object> fusion = new HashMap<>();
fusion.putAll((Map<String, Object>) requestDTO.getOptions());

JSONObject jsonSchema =
new JSONObject(
new JSONTokener(
jsonSchemaResolutionService
.resolveReferences(pkg.getConfig(), user.getRoles())
.toString()));

SchemaLoader loader =
SchemaLoader.builder()
.schemaJson(jsonSchema)
.draftV6Support() // or draftV7Support()
.build();
org.everit.json.schema.Schema schema = loader.load().build();
// Convert the options map to a JSONObject
JSONObject jsonObject = new JSONObject(fusion);
// Validate the options object against the schema
schema.validate(jsonObject);
// If getConfig is null that means that no schema is provided : skip validation
if (pkg.getConfig() != null) {
JSONObject jsonSchema =
new JSONObject(
new JSONTokener(
jsonSchemaResolutionService
.resolveReferences(pkg.getConfig(), user.getRoles())
.toString()));

SchemaLoader loader =
SchemaLoader.builder()
.schemaJson(jsonSchema)
.draftV6Support() // or draftV7Support()
.build();
org.everit.json.schema.Schema schema = loader.load().build();
// Convert the options map to a JSONObject
JSONObject jsonObject = new JSONObject(fusion);
// Validate the options object against the schema
schema.validate(jsonObject);
}

boolean skipTlsVerify = catalog.getSkipTlsVerify();
String caFile = catalog.getCaFile();
Expand Down
Loading