Stream: dotnet
Topic: anyone using Swashbuckle ?
Yunwei Wang (Jan 16 2017 at 21:19):
I am trying to use Swashbuckle/Swagger to generate document for FHIR WebAPI. I could not figure out how to generate examples for request parameter (type of Parameters).
Howard Edidin (Apr 09 2017 at 16:45):
I am using Task
Example:
public async Task<dynamic> Get
Add the Trex package, which allow you to annotate your input parameters
Here is a full example
[Metadata("Get New or Modified FHIR Documents",
"Query for new or modifed FHIR Documents By Resource Type " +
"from Last Run Date or Begiining of Collection creation"
)]
[SwaggerResponse(HttpStatusCode.OK, type: typeof(Task<dynamic>))]
[SwaggerResponse(HttpStatusCode.NotFound, "No New or Modifed Documents found")]
[SwaggerOperation("GetNewOrModifiedFHIRDocuments")]
public async Task<dynamic> GetNewOrModifiedFhirDocuments(
[Metadata("Database Id", "Database Id")] string databaseId,
[Metadata("Collection Id", "Collection Id")] string collectionId,
[Metadata("Resource Type", "FHIR resource type name")] string resourceType,
[Metadata("Start from Beginning ", "Change Feed Option")] bool startfromBeginning
)
Ewout Kramer (Apr 11 2017 at 08:20):
Hi Yunwei, I know @Grahame and @nicola (RIO) have taken a look at it - and we discussed it during the last FHIR DevDays. But I think the conclusion was that the datamodel is a bit too complicated for Swaggers infrastructure - but they may know more about it.
Yunwei Wang (Apr 12 2017 at 19:59):
My problem of using Swagger with FHIR is that everything is based on Resource class. But in our terminology service, the only resource (currently) available is ValueSet. And I cannot generate Swagger document based on ValueSet. Or one step further, generate swagger document based on my profile.
Grahame Grieve (Apr 15 2017 at 20:24):
can you explain why not? generating swagger doumentation is on my plate right now
Yunwei Wang (Apr 17 2017 at 15:42):
I can generate document but the document is almost useless unless doing big chunk of swagger attributes. For example, ValueSet operation takes Parameter as input. Parameters inherits from Resource. So in the generated document, all attributes from Resource, such as _id and other metadata attributes, are listed in the sample input document. But in reality, Parameters is used as a container of Parameter list.
Last updated: Apr 12 2022 at 19:14 UTC