OpenAPI "title" member

I am trying to use the output from ServiceStacks OpenAPI with dapperdox to automatically generate documentation for my service.

According to the dapperdox Wiki: “DapperDox requires that the optional schema object title member is present. DapperDox uses the title member to give the resource a name in the documentation it produces”

The output produced by ServiceStack does not seem to contain these title objects. Is there something I am missing something or is there some way I can get ServiceStack to add them?

Thanks in advance

Nic

Can you try v4.5.9 from MyGet? Title member was added in this coomit and is available from v4.5.9 on MyGet.

Perfect - that works really well. Titles are there but it doesn’t seem to output the ApiMember(Description = “”) data for request DTO?

Thank you.

Nic

[ApiMember(Description = "...")] sets the Description field of the schema for Title field type name is used.

Sorry - I wasn’t very clear:

I have the titles now but for the fields inside the request DTO the description is not being output. In my response DTO I am getting the descriptions output. I’m using the [ApiMember(Description="")] on both the request and the response DTO.

Thanks again

Nic

Can you provide a sample of DTO and annotated attributes on it which does not output description field in the resulting json?

The below DTO does not seem to be including descriptions in the OpenAPI.json. I am expecting to see the descrtptions in the output.

Let me know if it would be easier if I give you this in a sample project.

 [Api("Find, Create, Update and Delete candidates")]
[Route("/candidate/{CandidateRef}", "GET", Summary = "Get the specified candidate")]
public class CandidateGet : IReturn<CandidateGetResponse>, IProfileGetRequest
{
    [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; }
    [ApiMember(Description = "GET the candidate with this CandidateRef")]
    public Int32 CandidateRef { get; set; }
}

Sorry having some problems posting the code.

Thanks again

Nic

This should be fixed vith this commit. This change is available now on MyGet

Thanks - I don’t see any change but I’m not sure I’ve got the latest changes. I’ve followed all the instructions to get nuget to reload the packages. I was expecting a new ServiceStack.Api.OpenApi.dll or am I looking in the wrong place?

Sorry

Nic

Did you clear nuget cache? The version of the package is the same 4.5.9, but dll should be changed after clearing nuget cache and reinstalling the package.

Yes I’ve cleared using all the instructions on https://github.com/ServiceStack/ServiceStack/wiki/MyGet but I still have the ServiceStack.Api.OpenApi.dll dated 02/06/1017 21:27.

I also tried Update-Package -reinstall from the nuget package manager console but no change.

It doesn’t appear you’ve cleared your NuGet packages cache properly as I’ve just downloaded the NuGet package directly from MyGet at:

https://www.myget.org/F/servicestack/api/v2/package/ServiceStack.Api.OpenApi/4.5.9

And the dates on each artifact is the latest:

I’d try downloading the latest NuGet .exe from nuget.org:

https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

Then running again:

nuget locals all -clear

If that doesn’t work you can wait for 8-10hrs for the next release when the official NuGet packages will be updated to have a v4.5.10 version which will ignore any cached v4.5.9 MyGet packages.

Thanks mythz- the “new” nuget seemed to be the important difference over what I did yesterday.

I now have the new packages and can confirm that I have the descriptions for my elements too,

Awesome service from the ServiceStack team - really appreciated.

Nic

2 Likes