Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 18:35
    RicoSuter edited #3349
  • 18:18
    erwinkramer edited #3349
  • 18:18
    erwinkramer edited #3349
  • 18:12
    RicoSuter labeled #3344
  • 18:12
    RicoSuter labeled #3344
  • 18:12
    RicoSuter labeled #3347
  • 18:12
    RicoSuter labeled #3347
  • 18:12
    RicoSuter commented #3347
  • 17:55
    erwinkramer edited #3349
  • 17:54
    erwinkramer opened #3349
  • 17:41
    dependabot[bot] labeled #3348
  • 17:41

    dependabot[bot] on npm_and_yarn

    Bump elliptic from 6.5.3 to 6.5… (compare)

  • 17:41
    dependabot[bot] opened #3348
  • 17:20
    codingdna2 commented #3205
  • 16:59
    0xorial opened #3347
  • 16:58
    jeremyVignelles commented #3343
  • 16:50
    RicoSuter labeled #3342
  • 16:50
    RicoSuter labeled #3342
  • 16:50
    RicoSuter labeled #3342
  • 16:49
    RicoSuter commented #3343
Rico Suter
@RicoSuter
with
namespace System.Diagnostics.CodeAnalysis
{
    public class NotNullIfNotNullAttribute : Attribute
    {
        public NotNullIfNotNullAttribute(string parameterName)
        {
        }
    }
}
it works
Jérémy VIGNELLES
@jeremyVignelles
I think it has to do with this line:
urlBuilder_.Append((p_ == null) ? "" : System.Uri.EscapeDataString(ConvertToString(p_, System.Globalization.CultureInfo.InvariantCulture))).Append(",");
EscapeDataString takes a non nullable input
(because it throws if a null is given)
either we need to put a ! behind the call to ConvertToString, or we do it that way and make the compiler know that p_ is not null there, and there's no reason that ConvertToString returns a null
without the annotation, it would be considered nullable
Rico Suter
@RicoSuter

can we change the signature to

private string ConvertToString(object? value, System.Globalization.CultureInfo cultureInfo)

This way we can leave out the attribute and avoid warnings?

Jérémy VIGNELLES
@jeremyVignelles
that would change the behavior of the method, which I didn't want
but sure, that's probably a good thing to do

System.Convert.ToString(value, cultureInfo);

This returns null if value is null

But if we check at every place where this is used and there is no null given, then we can safely get rid of that
and return ""; instead of null if the parameter is null
or even better, disallow null parameter
Rico Suter
@RicoSuter
yeah, i see, but also it's just internal code - it doesnt need to be 100% correct in my opinion - im fine if the public api is correct
but probably this method should return "" and never null
as it's always used for query values, no?
Jérémy VIGNELLES
@jeremyVignelles
I was afraid I might have missed something, I'll check
I will try to find the time to do a PR in the next few days
Rico Suter
@RicoSuter
no worries, the NotNullIfNotNullAttribute inline thing works for me
it would just be nice if we could avoid that
Fixed the INPC stuff: RicoSuter/NJsonSchema@15c4367
Jérémy VIGNELLES
@jeremyVignelles
great, I'm not using INPC with NSwag, so I probably missed that
I usually don't put the property name as nullable anymore, I use "" instead
IIRC, it works well
Rico Suter
@RicoSuter
.. i think if we return "" and never null in ConvertToString it might be fine. But we'd need to check the ConvertToString usages, but it looks fine
Jérémy VIGNELLES
@jeremyVignelles
will do
agono
@agono
hi! how exactly can i use my own liquid template? i'am using NSwag studio to generate POCOs (for client) and everything works fine except Dates which are send by the service (not my service) in Unix epoch format in milliseconds. I found this on SO, but what i cannot find anywhere is where to put my custom templates: https://stackoverflow.com/questions/54094085/nswagstudio-liquid-templates
Jérémy VIGNELLES
@jeremyVignelles
@agono isn't there a TemplateDirectory setting?
aktxyz
@aktxyz
is it possible to tell swagger to ignore some routes ... I have a case where the same controller+method has multiple routes (legacy reasons to make same api have 2 names) ... but want one of the routes ignored when creating the swagger doc
Rico Suter
@RicoSuter
[OpenApiIgnore] attribute
aktxyz
@aktxyz
hmm ... I thought that only ignore methods ... but just tried and it looks like it ignores routes too ! thanks
Jérémy VIGNELLES
@jeremyVignelles
Toshko Andreev
@Ravenheart
hello
is there a way to generate a client that will do Xml requests
currently the generated models are sprinkled for Json serialization
but the service i'll be calling only supports Xml
Jon Reginbald Ivarsson
@reginbald
Hi, Is it possible to set a routePrefix so that swagger ui will be served from www.example.com ?
Rico Suter
@RicoSuter
@Ravenheart I think this is currently not possible (ie the xml serializer is not implemented) - there is an issue for that somewhere :-)
@reginbald did you try?
app.UseSwaggerUi3(p => p.Path = "/")
Jérémy VIGNELLES
@jeremyVignelles
Just wondering : What happens in NSwag when both "Default" response type and "success" (200) response type are set ? They can't both return, right ?
Jason Delladecimas
@JDelladecimas
Hi all, I have a .Net Core 3.1 project and I'm using NSwag with MSBuild to generate an angular client. The output is a single file with a module and all the C# controllers as services in it. Is there a way to split each service and module into separate files? This my first post so apologies if this is the wrong platform. Great product btw - saves a lot of dev time.
Jérémy VIGNELLES
@jeremyVignelles
@JDelladecimas : No, there isn't
Hobbes Pirakitti
@hobbes-visionfriendly-com
Hi! Quick question (I hope). I am using WebAPI / OWIN. I have a controller action that is [HttpGet] and takes a single parameter that is a "complex" type. That is, they argument to the parameter is a class that has a couple of properties. Is there a way to tell NSwag NOT to flatten that type into its properties when generating the OpenAPI JSON file?
Jérémy VIGNELLES
@jeremyVignelles
Don't know how webAPI/Owin works, but do you have an option to postprocess the OpenApi document as there is in asp.net core nswag?
Rico Suter
@RicoSuter
I think the complex type gets expanded into query parameters by default and thus it has to be described in the openapi spec in this way (there is no way to have complex query parameters in the spec)
Hobbes Pirakitti
@hobbes-visionfriendly-com

@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/