dependabot[bot] on npm_and_yarn
Bump elliptic from 6.5.3 to 6.5… (compare)
RicoSuter on NSwag-Build-1129
RicoSuter on release
Fix JsonSerializerParameterCode… Merge branch 'master' of https:… Use correct path and 7 more (compare)
app.UseSwaggerUi3(p => p.Path = "/")
@RicoSuter - I'm reading the OpenAPI 3 spec, and -- If I'm understanding it correctly -- it does seem to support "objects" as query parameters https://swagger.io/docs/specification/describing-parameters/#query-parameters:
"Query parameters can be primitive values, arrays and objects"
Related to that is how query parameters can be serialized: https://swagger.io/docs/specification/serialization/
PrepareRequest
methods to add the bearer token? and on the ProduceResponse
for the login method to get and store the token?
@RicoSuter - I am able to reproduce my "home route" problem starting from the sample "SampleOwinWebApiWithSwaggerUi" found here: https://github.com/NSwag/Samples/tree/master/src . Steps: 1) Run the sample and confirm that the home page shows up. 2) Upgrade all NSwag NuGet packages to 13.9.4. 3) In Startup.cs, change the call "UseSwaggerUi" to
UseSwaggerUi3(typeof(Startup).Assembly, s =>
{
s.Path = "/foo";
s.SwaggerRoutes.Add(new SwaggerUi3Route("My Fancy API v1", "/qwerty/asdf.json"));
});
Now when you run the project, instead of the home page, you see that it has been "hijacked" by raw Swagger JSON.
I've being using the partial client to add my JWT bearer tokens, but for some reason they don't always get added. But I can't see why.
async partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url)
{
_logger.LogInformation($"Prepare Request: {request.RequestUri.AbsoluteUri}");
var user = await _storage.GetItem<LoginResult>("user");
if (user != null)
{
_logger.LogInformation($"Adding Auth Header: {user.UserName}, {user.JwtToken}");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", user.JwtToken);
}
}
I can see in the chrome log the 'Preparing Request' and 'Adding Auth Header' messages, but the request has none added...its like the client as fired off the request already?
DateTime
fields as the Blazor UI toolkit I'm using doesn't support the DateTimeOffset
type, but these fields are being passed back to the API. I've tried JsonIgnore
, doesn't seem to change things.
Hi. I am using Nswag and generating typescript API definition from an api that has the attribute [OpenApiBodyParameter("application/octet-stream")]
//[ValidateAntiForgeryToken]
public async Task<ActionResult> Upload()
However the generated api code specifies Blob instead of File
upload(body: Blob | null | undefined): Promise<FileResponse | null> {
which generates an error when trying to read the content-type boundary. is there any other attribute I should be using so it generates the api with File instead of Blob?
related: RicoSuter/NSwag#2493
content_.Add(new System.Net.Http.StringContent(ConvertToString(profile, System.Globalization.CultureInfo.InvariantCulture)), "profile");
content_.Add(new System.Net.Http.StringContent(ConvertToString(profile, System.Globalization.CultureInfo.InvariantCulture), System.Text.Encoding.UTF8, "application/json"), "profile");
as per the spec: https://swagger.io/specification/#special-considerations-for-multipart-content
If the property is complex, or an array of complex values, the default Content-Type is application/json