public YAMLMapper configure(YAMLGenerator.Feature f, boolean state) { return state ? enable(f) : disable(f); }
public YAMLMapper configure(YAMLParser.Feature f, boolean state) { return state ? enable(f) : disable(f); }
public YAMLMapper configure(YAMLGenerator.Feature f, boolean state) { return state ? enable(f) : disable(f); }
public YAMLMapper configure(YAMLParser.Feature f, boolean state) { return state ? enable(f) : disable(f); }
public static <T> String toYamlString(T instance) { ObjectMapper mapper = new YAMLMapper() .disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID) .setSerializationInclusion(JsonInclude.Include.NON_EMPTY); try { return mapper.writeValueAsString(instance); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
@Override public String toString() { YAMLMapper mapper = new YAMLMapper().disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID); try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
@Override public String toString() { YAMLMapper mapper = new YAMLMapper().disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID); try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
@Override public String toString() { YAMLMapper mapper = new YAMLMapper().disable(YAMLGenerator.Feature.USE_NATIVE_TYPE_ID); try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
@RequestMapping(value = "/swaggerDetailed.yaml", method = RequestMethod.GET, produces = "application/yaml") public String getProjectSwaggerYaml() { ObjectMapper jsonWriter = new ObjectMapper() .setSerializationInclusion(JsonInclude.Include.NON_NULL); YAMLMapper yamlMapper = new YAMLMapper() .disable(WRITE_DOC_START_MARKER); try { Swagger swagger = swaggerGenerator.generateSwagger(); JsonNode jsonNode = jsonWriter.readTree( jsonWriter.writeValueAsBytes(swagger)); return yamlMapper.writeValueAsString(jsonNode); } catch (IOException e) { throw new RestAPIException("An error occurred while generating Swagger documentation", e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR, e); } }