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

io.swagger.transform.migrate.SwaggerJsonMigrator Maven / Gradle / Ivy

There is a newer version: 1.0.71
Show newest version
package io.swagger.transform.migrate;

import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.report.Message;
import io.swagger.report.MessageBuilder;
import io.swagger.report.Severity;
import io.swagger.transform.util.SwaggerMigrationException;

public abstract class SwaggerJsonMigrator {
    protected final SwaggerMigrator migrator;

    protected SwaggerJsonMigrator(final SwaggerMigrator migrator) {
        this.migrator = migrator;
    }

    public final JsonNode migrate(final MessageBuilder builder,
                                  final JsonNode node) {
        try {
            return migrator.migrate(node);
        } catch (SwaggerMigrationException e) {
            builder.append(new Message("", e.getMessage(), Severity.ERROR));
            return node;
        }
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy