com.linkedin.restli.tools.idlcheck.CompatibilityInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of restli-tools Show documentation
Show all versions of restli-tools Show documentation
Pegasus is a framework for building robust, scalable service architectures using dynamic discovery and simple asychronous type-checked REST + JSON APIs.
/*
Copyright (c) 2012 LinkedIn Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.linkedin.restli.tools.idlcheck;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.List;
public class CompatibilityInfo
{
public enum Level
{
INCOMPATIBLE,
COMPATIBLE
}
public enum Type
{
FINDER_ASSOCKEYS_DOWNGRADE(Level.INCOMPATIBLE, "Finder AssocKeys may not be downgraded to AssocKey"),
ARRAY_NOT_CONTAIN(Level.INCOMPATIBLE, "Current field must contain these values: %s"),
ARRAY_NOT_EQUAL(Level.INCOMPATIBLE, "Current field must be these values: %s"),
ARRAY_MISSING_ELEMENT(Level.INCOMPATIBLE, "\"%s\" has been removed from the current field"),
OTHER_ERROR(Level.INCOMPATIBLE, "%s"),
PARAMETER_NEW_REQUIRED(Level.INCOMPATIBLE, "Unable to add the new required parameter \"%s\""),
PARAMETER_WRONG_OPTIONALITY(Level.INCOMPATIBLE, "Unable to change the previous optional parameter to currently required"),
RESOURCE_MISSING(Level.INCOMPATIBLE, "Resource for \"%s\" is not found. This endpoint will not be released. Please remove this file and build again"),
TYPE_INCOMPATIBLE(Level.INCOMPATIBLE, "Previous type \"%s\" and current type \"%s\" are incompatible"),
TYPE_MISSING(Level.INCOMPATIBLE, "Type is required but missing"),
TYPE_UNKNOWN(Level.INCOMPATIBLE, "Type cannot be resolved: %s"),
VALUE_NOT_EQUAL(Level.INCOMPATIBLE, "Current value \"%2$s\" does not match the previous value \"%1$s\""),
VALUE_WRONG_OPTIONALITY(Level.INCOMPATIBLE, "\"%s\" may not be removed because it exists in the previous version"),
TYPE_BREAKS_OLD_READER(Level.INCOMPATIBLE, "%s, breaks old readers"),
TYPE_BREAKS_NEW_READER(Level.INCOMPATIBLE, "%s, breaks new readers"),
TYPE_BREAKS_NEW_AND_OLD_READERS(Level.INCOMPATIBLE, "%s, breaks new and old readers"),
DOC_NOT_EQUAL(Level.COMPATIBLE, "Documentation is updated"),
DEPRECATED(Level.COMPATIBLE, "%s is deprecated"),
PARAMETER_NEW_OPTIONAL(Level.COMPATIBLE, "New optional parameter \"%s\" is added"),
OPTIONAL_PARAMETER(Level.COMPATIBLE, "Previous required parameter is changed to currently optional"),
OPTIONAL_VALUE(Level.COMPATIBLE, "Optional field \"%s\" was previously missing but currently present"),
RESOURCE_NEW(Level.COMPATIBLE, "New resource is created in \"%s\""),
SUPERSET(Level.COMPATIBLE, "Current values have these extra values: %s"),
VALUE_DIFFERENT(Level.COMPATIBLE, "Previous value \"%s\" is changed to \"%s\""),
TYPE_INFO(Level.COMPATIBLE, "%s");
public String getDescription(Object[] parameters)
{
return String.format(_description, parameters);
}
public Level getLevel()
{
return _level;
}
private Type(Level level, String description)
{
_level = level;
_description = description;
}
private Level _level;
private String _description;
}
/**
* @param path path to the subject node in the idl (JSON) file, delimited by slash "/"
* @param type type of the information
*/
public CompatibilityInfo(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy