Skip to content
Merged
Show file tree
Hide file tree
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 @@ -33,7 +33,7 @@ public class JacksonJsonParser extends ObjectMapper implements JsonParser {
*/
public JacksonJsonParser() {
configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
this.jsonSchemaGenerator = new JsonSchemaGenerator(this);
this.jsonSchemaGenerator = new PolyJsonSchemaGenerator(this);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.polyapi.commons.internal.json;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.kjetland.jackson.jsonSchema.JsonSchemaGenerator;

/**
* Custom {@link JsonSchemaGenerator} that removes the spaces from the generated titles.
*/
public class PolyJsonSchemaGenerator extends JsonSchemaGenerator {
public PolyJsonSchemaGenerator(ObjectMapper rootObjectMapper) {
super(rootObjectMapper);
}

/**
* @see JsonSchemaGenerator#generateTitleFromPropertyName(String)
*/
@Override
public String generateTitleFromPropertyName(final String propertyName) {
return super.generateTitleFromPropertyName(propertyName).replace(" ", "");
}
}