question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenApi fails to use a model with a property named Aliases

See original GitHub issue

Hi guys, so, I have this model in my solution:

public class WeatherForecast
   {
       public DateTime Date { get; set; }

       public int TemperatureC { get; set; }

       public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

       public string Summary { get; set; }

       public List<Aliases> Aliases { get; set; }
   }

   public class Aliases
   {
       public DateTime Date { get; set; }

      
   }
}

If I try to add this property to the Function: [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(List<WeatherForecast>), Summary = "The response", Description = "This returns a weatherList")]

And if I try to check the Function Swagger, I get this error: image

If I change the name, the error disappears. For example, If I change the property name to Alias I have no problem, but if I make it Aliases it just gives me that error.

Can someone confirm whether or not this word is somehow reserved or is being used in the code and it’s giving this error?

I don’t know if this is actually related to this, but the azure functions open API extension solution has these 2 js Swagger Files that might be excluding the name:

image

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
justinyoocommented, Jul 12, 2021

Thanks for the confirmation. Let me have a look.

1reaction
level120commented, Aug 27, 2021

That’s interesting! I will try this issue, but i’m not sure that solve or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to alias a model properties in YAML
I tried the following ways to achieve the result, but was unable to succeed. diskName: type: "string" x-constraints: maxLength: "ConstantRef( ...
Read more >
Schema property alternative names · Issue #2055
I would like to suggest to extend schema property by "alternativeName": "type" : "object", "properties : { "property1" : { "type" : "string" ......
Read more >
OpenAPI Specification - Version 3.0.3
The schema exposes two types of fields: Fixed fields, which have a declared name, and Patterned fields, which declare a regex pattern for...
Read more >
Usage | OpenAPI Generator
displays types used to instantiate simple type/alias names ... the generate command for a go client, use the --additional-properties option.
Read more >
OpenAPI Specification v3.0.3 | Introduction, Definitions, & ...
Any HTTP status code can be used as the property name, but only one property per code, to describe the expected response for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found