Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize the order in which fields are displayed #4881

Open
Boundless666 opened this issue May 4, 2024 · 0 comments
Open

How to customize the order in which fields are displayed #4881

Boundless666 opened this issue May 4, 2024 · 0 comments

Comments

@Boundless666
Copy link

public class Pagination{
    public int start {get;}
    public int end {get;}
}

public class ReqDTO: Pagination{
    ///
    /// this is name
    ///
    [Required]
    public string Name {get; set;}
    
    ///
    /// this is count
    ///
    public string Count {get; set;}
}
public class TestController: ControllerBase
{
    [OpenApiBodyParameter("application/x-www-form-urlencoded")]
	[HttpPost]
    public IActionResult GetList(ReqDTO req){
        
    }
}

The JSON file generated by default is as follows:

"ReqDTO": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Pagination"
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "Name"
            ],
            "properties": {
              "Name": {
                "type": "string",
                "description": "this is name",
                "minLength": 1
              },
              "Count": {
                "type": "integer",
                "description": "this is count",
                "nullable": true
              },
            }
          }
        ]
      },

in the redoc UI

// The order in which the fields are displaed in the redoc UI document
// default
Fields		Description

start		
end		
Name		this is name
Count		this is count
// I’d like to be able to control the order in which the fileds are displayed
// like this:
Fields		Description

Name		this is name
Count		this is count
start		
end		

I want the fields of the objects referenced in allOf to be ranked after the fields of the inheritance class at the time of the final rendering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant