All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.schegge.rest.markdown.SchemaCollector Maven / Gradle / Ivy

package de.schegge.rest.markdown;

import de.schegge.rest.markdown.openapi.ApiDescription;
import de.schegge.rest.markdown.openapi.Components;
import de.schegge.rest.markdown.openapi.Schema;
import java.util.Map;

public class SchemaCollector implements ApiVisitor> {

  @Override
  public ApiDescription visit(ApiDescription apiDescription, Map input) {
    apiDescription.components().accept(this, input);
    return apiDescription;
  }

  @Override
  public Components visit(Components components, Map input) {
    components.schemas().forEach((key, value) -> value.accept(this, key, input));
    return components;
  }

  @Override
  public Schema visit(Schema schema, String name, Map input) {
    schema.setName(name);
    input.put("#/components/schemas/" + name, schema);
    return schema;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy