@Test public void shouldConvertJsonSchemaToXsdTypes() { assertThat(XmlSchemaHelper.toXsdType("boolean")).isEqualTo(XmlSchemaHelper.XML_SCHEMA_PREFIX + ":boolean"); assertThat(XmlSchemaHelper.toXsdType("number")).isEqualTo(XmlSchemaHelper.XML_SCHEMA_PREFIX + ":decimal"); assertThat(XmlSchemaHelper.toXsdType("string")).isEqualTo(XmlSchemaHelper.XML_SCHEMA_PREFIX + ":string"); assertThat(XmlSchemaHelper.toXsdType("integer")).isEqualTo(XmlSchemaHelper.XML_SCHEMA_PREFIX + ":integer"); }
public static String toXsdType(final String type) { switch (type) { case "boolean": return XML_SCHEMA_PREFIX + ":boolean"; case "number": return XML_SCHEMA_PREFIX + ":decimal"; case "string": return XML_SCHEMA_PREFIX + ":string"; case "integer": return XML_SCHEMA_PREFIX + ":integer"; default: throw new IllegalArgumentException("Unexpected type `" + type + "` given to convert to XSD type"); } }
XmlSchemaHelper { public static String toXsdType(final String type) { switch (type) { case "boolean": return XML_SCHEMA_PREFIX + ":boolean"; case "number": return XML_SCHEMA_PREFIX + ":decimal"; case "string": return XML_SCHEMA_PREFIX + ":string"; case "integer": return XML_SCHEMA_PREFIX + ":integer"; default: throw new IllegalArgumentException("Unexpected type `" + type + "` given to convert to XSD type"); } } }
XmlSchemaHelper { public static String toXsdType(final String type) { switch (type) { case "boolean": return XML_SCHEMA_PREFIX + ":boolean"; case "number": return XML_SCHEMA_PREFIX + ":decimal"; case "string": return XML_SCHEMA_PREFIX + ":string"; case "integer": return XML_SCHEMA_PREFIX + ":integer"; default: throw new IllegalArgumentException("Unexpected type `" + type + "` given to convert to XSD type"); } } private  XmlSchemaHelper(); }
XmlSchemaHelper { public static String toXsdType(final String type) { switch (type) { case "boolean": return XML_SCHEMA_PREFIX + ":boolean"; case "number": return XML_SCHEMA_PREFIX + ":decimal"; case "string": return XML_SCHEMA_PREFIX + ":string"; case "integer": return XML_SCHEMA_PREFIX + ":integer"; default: throw new IllegalArgumentException("Unexpected type `" + type + "` given to convert to XSD type"); } } private  XmlSchemaHelper(); static Element addElement(final Element parent, final String name); static Element addElement(final Element parent, final String... names); static boolean isAttribute(final OasSchema property); static boolean isElement(final OasSchema property); static String nameOf(final OasSchema property); static String nameOrDefault(final OasSchema property, final String name); static Element newXmlSchema(final String targetNamespace); static String serialize(final Document document); static String toXsdType(final String type); static String xmlNameOrDefault(final OasXML xml, final String defaultName); static String xmlTargetNamespaceOrNull(final OasSchema property); }
XmlSchemaHelper { public static String toXsdType(final String type) { switch (type) { case "boolean": return XML_SCHEMA_PREFIX + ":boolean"; case "number": return XML_SCHEMA_PREFIX + ":decimal"; case "string": return XML_SCHEMA_PREFIX + ":string"; case "integer": return XML_SCHEMA_PREFIX + ":integer"; default: throw new IllegalArgumentException("Unexpected type `" + type + "` given to convert to XSD type"); } } private  XmlSchemaHelper(); static Element addElement(final Element parent, final String name); static Element addElement(final Element parent, final String... names); static boolean isAttribute(final OasSchema property); static boolean isElement(final OasSchema property); static String nameOf(final OasSchema property); static String nameOrDefault(final OasSchema property, final String name); static Element newXmlSchema(final String targetNamespace); static String serialize(final Document document); static String toXsdType(final String type); static String xmlNameOrDefault(final OasXML xml, final String defaultName); static String xmlTargetNamespaceOrNull(final OasSchema property); static final String XML_SCHEMA_NS; static final String XML_SCHEMA_PREFIX; }