io.swagger.v3.oas.models.media.XML.getWrapped()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中io.swagger.v3.oas.models.media.XML.getWrapped()方法的一些代码示例,展示了XML.getWrapped()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML.getWrapped()方法的具体详情如下:
包路径:io.swagger.v3.oas.models.media.XML
类名称:XML
方法名:getWrapped

XML.getWrapped介绍

[英]returns the wrapped property from a XML instance.
[中]

代码示例

代码示例来源: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: swagger-api/swagger-core

assertNull(xml.getName());
  assertTrue(xml.getAttribute());
  assertNull(xml.getWrapped());
} else if ("name".equals(name)) {
  final XML xml = property.getXml();
  assertEquals(xml.getName(), "renamed");
  assertNull(xml.getAttribute());
  assertNull(xml.getWrapped());
} else if (Arrays.asList("list", "forcedElement").contains(name)) {
  assertNull(property.getXml());
  assertEquals(xml.getName(), "wrappedListItems");
  assertNull(xml.getAttribute());
  assertTrue(xml.getWrapped());
} else {
  fail(String.format("Unexpected property: %s", name));

代码示例来源: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: org.openapitools/openapi-generator

Schema inner = as.getItems();
boolean wrapped = false;
if (schema.getXml() != null && schema.getXml().getWrapped() != null && schema.getXml().getWrapped()) {
  wrapped = true;

代码示例来源:origin: io.swagger/swagger-codegen-generators

if (propertySchema.getXml() != null) {
  codegenProperty.getVendorExtensions().put(CodegenConstants.IS_XML_WRAPPED_EXT_NAME,
      propertySchema.getXml().getWrapped() == null ? false : propertySchema.getXml().getWrapped());
  codegenProperty.xmlPrefix= propertySchema.getXml().getPrefix();
  codegenProperty.xmlNamespace = propertySchema.getXml().getNamespace();

代码示例来源:origin: io.swagger.codegen.v3/swagger-codegen-generators

if (propertySchema.getXml() != null) {
  codegenProperty.getVendorExtensions().put(CodegenConstants.IS_XML_WRAPPED_EXT_NAME,
      propertySchema.getXml().getWrapped() == null ? false : propertySchema.getXml().getWrapped());
  codegenProperty.xmlPrefix= propertySchema.getXml().getPrefix();
  codegenProperty.xmlNamespace = propertySchema.getXml().getNamespace();

代码示例来源:origin: org.openapitools/openapi-generator

property.baseType = getSchemaType(p);
if (p.getXml() != null) {
  property.isXmlWrapped = p.getXml().getWrapped() == null ? false : p.getXml().getWrapped();
  property.xmlPrefix = p.getXml().getPrefix();
  property.xmlNamespace = p.getXml().getNamespace();

相关文章