Comments (10)
@Frankyfrankly Thanks for the issue. I looked at the issue, but if you change the models' structure it will solve your issue:
public class Book
{
...
public string AuthorId { get; set; }
}
public class Author
{
...
public List<Book> Books { get; set; }
}
To me, the circular reference issue is about how data structure looks like, rather than the issue of this extension. If you still want to keep the Author
in your Book
class, I would recommend adding the [OpenApiIgnore()]
decorator on top of it like:
public class Book
{
...
public string AuthorId { get; set; }
[OpenApiIgnore()]
public Author Author { get; set; }
}
By doing so, you will avoid the circular reference issue.
from azure-functions-openapi-extension.
@Frankyfrankly I'll close the issue for now. If you'd like to discuss more on this, please open a new issue.
from azure-functions-openapi-extension.
Related to: aliencube/AzureFunctions.Extensions#134
from azure-functions-openapi-extension.
Hi @justinyoo ,
I run into same problem as is described aliencube/AzureFunctions.Extensions#134
In my case I use health check library in Azure function project. And the response type HealthReport contains additional types including Exception type.
I guess this is root cause of a bug and circular reference.
As you see, these types cannot be changed as you suggest above.
Also I attached call stack when exception is thrown
I am open to help in investigation of the issue.
from azure-functions-openapi-extension.
...
[OpenApiIgnore()] public Author Author { get; set; } }By doing so, you will avoid the circular reference issue.
This is not working for me as OpenApiIgnoreAttibute seems to only be valid for AttributeTargets.Method
.
from azure-functions-openapi-extension.
@john-patterson Oops my bad. I meant JsonIgnore
.
from azure-functions-openapi-extension.
@justinyoo ah. Okay, yeah I see in the code where that gets selected out. Unfortunately JsonIgnore
isn't a great general solution as my other serializers handle my class just fine (my class Reviewer
has an array of reviewers for whom they vote, based on the Azure DevOps type IdentityRefWithVote
).
Is there opposition to a PR that generalizes OpenApiIgnore
a bit to target properties and fields as well along with a patch to the RecursiveObjectTypeVisitor
, ObjectTypeVisitor
, and TypeExtensions
? This should be backward compatible as JsonIgnore
will still result in ignoring the attribute and OpenApiIgnore
on methods will continue to behave the same.
If this works from a product management perspective, I can get a PR thrown together later today.
from azure-functions-openapi-extension.
@vlaskal Thanks for your suggestion! What I'm suspecting where the StackOverflowException or CircularReferenceException occurs is these two parts:
Adding the reference schemas should also be done before traversing each type's properties.
It would be great if you can have a look. Once it's fixed, @john-patterson you wouldn't need to extend the OpenApiIgnore
decorator.
from azure-functions-openapi-extension.
@justinyoo Thanks for hints. I will try too look at it and will reach you back.
from azure-functions-openapi-extension.
I have the same issue and a possible solution in #467
from azure-functions-openapi-extension.
Related Issues (20)
- Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore support HOT 1
- .NET 8, Function Decorators Not Recognized HOT 27
- Loading types from referenced dll's should be optional, very poor performance of generating swagger document for large projects.
- .NET 8 isolated process - "The type or namespace name 'Azure' does not exist..." HOT 1
- Cannot Generate Open API swagger.json file if inheriting from ITableEntity From Azure.Data.Tables HOT 1
- Support for X-Forwarded-Host HOT 2
- Ordering tags alphanumerically
- IOpenApiHttpTriggerAuthorization requires IHttpRequestDataObject but function has HttpRequestData
- Support Specification Extensions HOT 1
- Setting the base url in isolated worker azure function HOT 2
- Add more options to control exposed Swagger endpoints HOT 1
- .NET framework Isolated - The system cannot find the file specified.
- No way to add example to a parameter definition using attributes - OpenApiParameterAttribute does not support all properties of Microsoft.OpenApi.Models OpenApiParameter
- Easy Auth enabled on Azure portal for function app not allowed to exposed Swagger endpoints
- Future of this project? HOT 3
- Adding custom attribute to the openAPI endpoints possible?
- Documentation: Update .ConfigureFunctionsWorkerDefaults(...) to be .ConfigureFunctionsWebApplication(...)
- Synchronous operations are disallowed HOT 1
- Generate OpenApi swagger at build time. HOT 1
- Swagger Serializer Settings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-functions-openapi-extension.