kong icon indicating copy to clipboard operation
kong copied to clipboard

feat(db): add entity_checks for /schema endpoint

Open jschmid1 opened this issue 1 year ago • 0 comments

Summary

The /schemas/{plugins,$daos} endpoint now not only returns fields, but also any canonical entity_checks that can't be expressed otherwise within the field validators themselves.

We do not include custom_entity_checks that usually implement custom lua functions to verify the validity.

For example:

http :8001/schemas/keys

// shortened for brevity
{                                                                                                                                                           
    "entity_checks": [                                                                                                                                      
        {                                                                                                                                                   
            "mutually_exclusive": [                                                                                                                         
                "jwk",                                                                                                                                      
                "pem"                                                         
            ]                                                                                                                                               
        },                                                                                                                                                                                                                                                                
    ],                                                                        
    "fields": [                                                                                                                                             
        {                                                                                                                                                   
            "id": {                                                                                                                                         
                "auto": true,                                                                                                                               
                "description": "A string representing a UUID (universally unique identifier).",                                                             
                "type": "string",                                                                                                                           
                "uuid": true                                                                                                                                
            },                                                                                                                                               
        },
     ],                 
}

Checklist

  • [x] The Pull Request has tests
  • [x] There's an entry in the CHANGELOG

Full changelog

  • Add entity_checks to /schemas endpoint output

Issue reference

https://konghq.atlassian.net/browse/KAG-1593

jschmid1 avatar Jun 23 '23 12:06 jschmid1