I have some properties in the object that corresponds to the request body, but I would like to hide them from Swagger UI documentation, because their purpose is just to work in the background along the request flow. I've tried some solutions to POST and GET requests, but when the request is sent by FormData and I have properties that are navigation properties (an object), the settings don't work and the information is shown in Swagger UI.
Let me give an example.
I have a class which is used to store (in memory) the logged in user data:
public class LoggedUser
{
public UserInfo(long id, string name)
{
Id = id;
Name = name;
}
public long Id { get; init; }
public string Name { get; init; }
}
And I have a class which is used as a base for the request body classes:
public abstract class RequestCommand
{
public LoggedUser User{ get; init; }
...
}
But these properties are shown in Swagger UI:
I've tried to use this solution: Ignore [FromForm] data from rendering on swagger
but when I have navigation properties like on the image above (User.Id
, User.Name
, ...) it does not work.
I would like to find a solution that can hide these properties from Swagger UI.