本文整理了Java中io.swagger.v3.oas.models.media.XML.getName()
方法的一些代码示例,展示了XML.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML.getName()
方法的具体详情如下:
包路径:io.swagger.v3.oas.models.media.XML
类名称:XML
方法名:getName
[英]returns the name property from a XML instance.
[中]从XML实例返回name属性。
代码示例来源:origin: swagger-api/swagger-core
@Override
public Optional<Schema> filterSchema(Schema schema, Map<String, List<String>> params, Map<String, String> cookies, Map<String, List<String>> headers) {
if (schema == null || StringUtils.isBlank(schema.getXml().getName())) {
return Optional.of(schema);
}
if (schema.getXml().getName().equals(MODEL)) {
return Optional.empty();
}
return Optional.of(schema);
}
}
代码示例来源:origin: io.swagger/swagger-codegen-generators
codegenProperty.xmlName = propertySchema.getXml().getName();
codegenProperty.xmlNamespace = propertySchema.getXml().getNamespace();
codegenProperty.xmlPrefix= propertySchema.getXml().getPrefix();
codegenProperty.xmlNamespace = propertySchema.getXml().getNamespace();
codegenProperty.xmlName = propertySchema.getXml().getName();
代码示例来源:origin: io.swagger.codegen.v3/swagger-codegen-generators
codegenProperty.xmlName = propertySchema.getXml().getName();
codegenProperty.xmlNamespace = propertySchema.getXml().getNamespace();
codegenProperty.xmlPrefix= propertySchema.getXml().getPrefix();
codegenProperty.xmlNamespace = propertySchema.getXml().getNamespace();
codegenProperty.xmlName = propertySchema.getXml().getName();
代码示例来源:origin: swagger-api/swagger-core
@Test(description = "it should process an XML model attribute")
public void processXMLModelAttribute() {
final Map<String, Schema> schemas = ModelConverters.getInstance().readAll(Monster.class);
final Schema model = schemas.get("Monster");
assertNotNull(model);
assertTrue(model instanceof Schema);
XML xml = model.getXml();
assertNotNull(xml);
assertEquals(xml.getName(), "monster");
final Schema property = (Schema) model.getProperties().get("children");
assertNotNull(property);
xml = property.getXml();
assertTrue(xml.getWrapped());
assertNull(xml.getName());
}
代码示例来源:origin: io.swagger/swagger-codegen-generators
codegenModel.xmlPrefix = schema.getXml().getPrefix();
codegenModel.xmlNamespace = schema.getXml().getNamespace();
codegenModel.xmlName = schema.getXml().getName();
.getNamespace();
codegenModel.xmlName = innerModel.getXml()
.getName();
代码示例来源:origin: swagger-api/swagger-core
@Test(description = "it should serialize a parameterized type per 606")
public void serializeParameterizedType() {
final Map<String, Schema> schemas = readAll(Employee.class);
final Schema employee = (Schema) schemas.get("employee");
final Map<String, Schema> props = employee.getProperties();
final Iterator<String> et = props.keySet().iterator();
final Schema id = props.get(et.next());
assertTrue(id instanceof IntegerSchema);
final Schema firstName = props.get(et.next());
assertTrue(firstName instanceof StringSchema);
final Schema lastName = props.get(et.next());
assertTrue(lastName instanceof StringSchema);
final Schema department = props.get(et.next());
assertNotNull(department.get$ref());
final Schema manager = props.get(et.next());
assertNotNull(manager.get$ref());
final Schema team = props.get(et.next());
assertTrue(team instanceof ArraySchema);
final ArraySchema ap = (ArraySchema) team;
assertTrue(ap.getUniqueItems());
assertNotNull(employee.getXml());
assertEquals(employee.getXml().getName(), "employee");
}
代码示例来源:origin: io.swagger.codegen.v3/swagger-codegen-generators
codegenModel.xmlPrefix = schema.getXml().getPrefix();
codegenModel.xmlNamespace = schema.getXml().getNamespace();
codegenModel.xmlName = schema.getXml().getName();
.getNamespace();
codegenModel.xmlName = innerModel.getXml()
.getName();
代码示例来源:origin: swagger-api/swagger-core
@Test
public void testReadingXmlAccessorTypePublic() throws Exception {
final ModelConverter mr = modelResolver();
final Schema model = mr.resolve(new AnnotatedType(XmlDecoratedBeanXmlAccessorPublic.class), new ModelConverterContextImpl(mr), null);
final XML xml = model.getXml();
assertNotNull(xml);
assertEquals(xml.getName(), "xmlDecoratedBean");
final Schema propertyA = (Schema) model.getProperties().get("a");
assertNotNull(propertyA);
final Schema propertyB = (Schema) model.getProperties().get("b");
assertNotNull(propertyB);
final Schema propertyC = (Schema) model.getProperties().get("c");
assertNull(propertyC);
}
代码示例来源:origin: org.openapitools/openapi-generator
m.xmlPrefix = schema.getXml().getPrefix();
m.xmlNamespace = schema.getXml().getNamespace();
m.xmlName = schema.getXml().getName();
m.xmlPrefix = innerModel.getXml().getPrefix();
m.xmlNamespace = innerModel.getXml().getNamespace();
m.xmlName = innerModel.getXml().getName();
代码示例来源:origin: swagger-api/swagger-core
@Test
public void testReadingXmlAccessorTypeNone() throws Exception {
final ModelConverter mr = modelResolver();
final Schema model = mr.resolve(new AnnotatedType(XmlDecoratedBeanXmlAccessorNone.class), new ModelConverterContextImpl(mr), null);
final XML xml = model.getXml();
assertNotNull(xml);
assertEquals(xml.getName(), "xmlDecoratedBean");
final Schema property = (Schema) model.getProperties().get("a");
assertNotNull(property);
assertNull(model.getProperties().get("b"));
assertNotNull(model.getProperties().get("c"));
assertNotNull(model.getProperties().get("d"));
assertNotNull(model.getProperties().get("e"));
assertNotNull(model.getProperties().get("f"));
}
代码示例来源:origin: org.openapitools/openapi-generator
property.xmlName = p.getXml().getName();
property.xmlNamespace = p.getXml().getNamespace();
property.xmlPrefix = p.getXml().getPrefix();
property.xmlNamespace = p.getXml().getNamespace();
property.xmlName = p.getXml().getName();
代码示例来源:origin: swagger-api/swagger-core
@Test
public void testSimple() throws Exception {
final ModelConverter mr = modelResolver();
ModelConverterContextImpl ctx = new ModelConverterContextImpl(mr);
final Schema model = mr.resolve(new AnnotatedType(XmlDecoratedBean.class), ctx, null);
final XML xml = model.getXml();
assertNotNull(xml);
assertEquals(xml.getName(), "xmlDecoratedBean");
// Cast it to an array property
final ArraySchema property = (ArraySchema) model.getProperties().get("elements");
assertNotNull(property);
final XML propertyXml = property.getXml();
assertNotNull(propertyXml);
assertNull(propertyXml.getName());
assertTrue(propertyXml.getWrapped());
// Get the xml for items for the array property
final XML itemsXml = property.getItems().getXml();
assertNotNull(itemsXml);
// Check the name of item name
assertEquals(itemsXml.getName(), "element");
assertNotNull(model.getProperties().get("elementC"));
}
代码示例来源:origin: swagger-api/swagger-core
assertEquals(rootXml.getName(), "rootName");
final XML xml = property.getXml();
assertNotNull(xml);
assertNull(xml.getName());
assertTrue(xml.getAttribute());
assertNull(xml.getWrapped());
final XML xml = property.getXml();
assertNotNull(xml);
assertEquals(xml.getName(), "renamed");
assertNull(xml.getAttribute());
assertNull(xml.getWrapped());
final XML xml = property.getXml();
assertNotNull(xml);
assertEquals(xml.getName(), "wrappedListItems");
assertNull(xml.getAttribute());
assertTrue(xml.getWrapped());
代码示例来源:origin: swagger-api/swagger-core
assertNotNull(wrappedList);
assertNotNull(wrappedList.getXml());
assertEquals(wrappedList.getXml().getName(), "wrappedListItems");
代码示例来源:origin: org.openapitools/openapi-generator
XML xml = schema.getXml();
if (xml != null) {
if (xml.getName() != null) {
name = xml.getName();
代码示例来源:origin: org.openapitools/openapi-generator
@Override
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
CodegenModel mdl = super.fromModel(name, model, allDefinitions);
mdl.vendorExtensions.put("upperCaseName", name.toUpperCase(Locale.ROOT));
if (!StringUtils.isEmpty(model.get$ref())) {
Schema schema = allDefinitions.get(ModelUtils.getSimpleRef(model.get$ref()));
mdl.dataType = typeMapping.get(schema.getType());
}
if (ModelUtils.isArraySchema(model)) {
ArraySchema am = (ArraySchema) model;
if ((am.getItems() != null) &&
(am.getItems().getXml() != null)) {
// If this model's items require wrapping in xml, squirrel
// away the xml name so we can insert it into the relevant model fields.
String xmlName = am.getItems().getXml().getName();
if (xmlName != null) {
mdl.vendorExtensions.put("itemXmlName", xmlName);
modelXmlNames.put("models::" + mdl.classname, xmlName);
}
}
mdl.arrayModelType = toModelName(mdl.arrayModelType);
}
if (mdl.xmlNamespace != null) {
additionalProperties.put("usesXmlNamespaces", true);
}
return mdl;
}
内容来源于网络,如有侵权,请联系作者删除!