io.swagger.transform.migrate.SwaggerMigrator Maven / Gradle / Ivy
package io.swagger.transform.migrate;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.transform.util.MutableJsonTree;
import io.swagger.transform.util.SwaggerMigrationException;
import io.swagger.transform.util.SwaggerMigrators;
import javax.annotation.Nonnull;
/**
* Core interface for JSON migration
*
* This takes a {@link JsonNode} as an input and outputs the transformed
* {@link JsonNode}.
*
* Note that this interface makes no guarantee as to whether
* a new {@code JsonNode} is returned, or the input argument is
* returned (altered or not). If this distinction is important, please document
* it in your implementation(s).
*
* You can either implement this interface directly or use one of the
* predefined migrators in {@link SwaggerMigrators}.
*
* @see SwaggerMigrators
* @see MutableJsonTree#applyMigrator(SwaggerMigrator)
* @see MutableJsonTree#applyMigratorToElements(SwaggerMigrator)
*/
public interface SwaggerMigrator {
/**
* Migrate a JSON input
*
* @param input the input node
* @return the migrated node
* @throws SwaggerMigrationException migration failed
*/
@Nonnull
JsonNode migrate(@Nonnull final JsonNode input)
throws SwaggerMigrationException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy