You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get my SwashBuckle/Swagger GUI to show the correct elements based on how I set it in code. Currently the example output looks like this:
<HttpPost>
Public Function PostGeneric(some As SomesModel) As HttpResponseMessage
Return New HttpResponseMessage(Net.HttpStatusCode.Accepted)
End Function
Root XML object
<Serializable()>
<XmlRoot(ElementName:="Somes", [Namespace]:="")>
<XmlType("Somes")>
Public Class SomesModel
<XmlElement(ElementName:="Some")>
Public Property Somes As List(Of SomeModel)
End Class
Sub XML Object
<Serializable()>
<XmlType("Some")>
Public Class SomeModel
<XmlElement>
Public Property SomeID As String
<XmlElement>
Public Property SomeName As String
<XmlElement>
Public Property SomeBool As Boolean
<XmlElement(ElementName:="Classes")>
Public Property SomeClasses As New SomeClassesModel
End Class
Sub XML Classes Object
<Serializable()>
<XmlType("Classes")>
Public Class SomeClassesModel
<XmlElement(ElementName:="Class")>
Public Property SomeClasses As List(Of ClassModel)
End Class
Sub XML Class Object
<Serializable()>
<XmlType("Class")>
Public Class ClassModel
<XmlElement>
Public Property SomeValue As Integer
End Class
I specify all the annotations that I normally do when serializing a xml.
What extra settings does SwashBuckle need to get the xml serialized correctly?
I have tried editing the xml annotations, but it seems like Swashbuckle just ignores them. Some stack overflow suggestions was to try XMLType and others suggested using XMLRoot and XmlElements. I have tried all combinations of those.
What I would expect it to look like is this as the output.
@domaindrivendev I have figured out how to set the out layer of Somes and Some. I can't figure out the correct way to set the inner class object being renamed from SomeClasses and SomeClass to Classes and Class. I am setting it in the SchemaFilter.
Public Sub Apply(schema As Schema, registry As SchemaRegistry, type As Type) Implements ISchemaFilter.Apply
I am setting the name of the XML item like:
schema.xml = New Xml With
{
.name = XmlRootAttribute.ElementName
}
I am trying to get my SwashBuckle/Swagger GUI to show the correct elements based on how I set it in code. Currently the example output looks like this:
My current code structure looks like this:
WepApiConfig
Controller code
Root XML object
Sub XML Object
Sub XML Classes Object
Sub XML Class Object
I specify all the annotations that I normally do when serializing a xml.
What extra settings does SwashBuckle need to get the xml serialized correctly?
I have tried editing the xml annotations, but it seems like Swashbuckle just ignores them. Some stack overflow suggestions was to try XMLType and others suggested using XMLRoot and XmlElements. I have tried all combinations of those.
What I would expect it to look like is this as the output.
The text was updated successfully, but these errors were encountered: