Autogeneration of WSDL failed

Hi,

I’m getting the following exception when I click on a WSDL link in SS. I believe this error has only started since I upgraded my project to 4.5.13:

sdlMetadataHandlerBase Error - Autogeneration of WSDL failed.
System.Xml.Schema.XmlSchemaException: Multiple definition of element ‘http://schemas.datacontract.org/2004/07/ServiceStack.Api.OpenApi.Specification:required’ causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
at System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object sender, ValidationEventArgs e)
at System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity)
at System.Xml.Schema.Compiler.CompileComplexContent(XmlSchemaComplexType complexType)
at System.Xml.Schema.Compiler.CompileComplexType(XmlSchemaComplexType complexType)
at System.Xml.Schema.Compiler.Compile()
at System.Xml.Schema.Compiler.Execute(XmlSchemaSet schemaSet, SchemaInfo schemaCompiledInfo)
at System.Xml.Schema.XmlSchemaSet.Compile()
at System.Runtime.Serialization.SchemaImporter.CompileSchemaSet(XmlSchemaSet schemaSet)
at ServiceStack.XsdUtils.GetXmlSchemaSet(ICollection`1 operationTypes)
at ServiceStack.Metadata.XsdGenerator.ToString()
at ServiceStack.Metadata.WsdlMetadataHandlerBase.GetWsdlTemplate(XsdMetadata operations, String baseUri, Boolean optimizeForFlash, String rawUrl, String serviceName)
at ServiceStack.Metadata.WsdlMetadataHandlerBase.Execute(IRequest httpReq, IResponse httpRes)

Thanks

Nic

From which version of ServiceStack did you upgrade? Can you provide some more info about your dtos to help us to reproduce this issue?

I’m not 100% sure. I have not been keeping an eye on the WSDL generation as it was working. I think 4.5.10 was my last working version.

My DTO’s are plain vanilla with nothing of note, such as:

 [Api("Get lookup codes")]
    [Route("/lookup/{UsageNumber}", "GET", Summary = "Get all the lookup codes for the specified usage", Notes = "Codes are returned in alphanumeric code order")]
    public class LookupGet : IReturn<LookupGetResponse>, IProfileGetRequest
    {
        // Standard interface for all get calls
        [ApiMember(Description = "The number of results to SKIP")]
        public int Skip { get; set; }
        [ApiMember(Description = "The number of results to TAKE (i.e. return). Max 1000", IsRequired = true)]
        public int Take { get; set; }

        // Unique to this get 
        [ApiMember(Description = "The usage to return codes for", IsRequired = true)]
        [ServiceField(Required = true)]
        public Int32 UsageNumber { get; set; }

        [ApiMember(Description = "Include codes that are nolonger or not yet valid?")]
        public bool IncludeInvalid { get; set; }
    }

    public class LookupGetResponse : IHasResponseStatus
    {
        public LookupGetResponse()
        {
            Lookups = new List<Lookup>();
        }

        public List<Lookup> Lookups { get; set; }
        public ResponseStatus ResponseStatus { get; set; }
    }

    public class Lookup
    {
        [ApiMember(Description = "The lookup code")]
        public string Code { get; set; }
        [ApiMember(Description = "The lookup description")]
        public string Description { get; set; }
        [ApiMember(Description = "A longer description, sometimes used for mapping codes to 3rd party systems")]
        public string LongDescription { get; set; }
    }

I am using the OpenAPI and swagger-ui plugins and both are working fine. Given that the error is about "‘http://schemas.datacontract.org/2004/07/ServiceStack.Api.OpenApi.Specification:required’ is there something I could have done to cause this? I don’t really know where to start.

Thanks for the info, I caught this exception and I’m looking into it.

This issue should be fixed via this commit which is available from v.4.5.13 on MyGet

All good now - thank you for the quick response.