Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/schema/proxy.py: 0%

15 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-15 02:12 +0000

1#!/usr/bin/env python 

2# -*- coding: utf-8 -*- 

3from marshmallow import Schema, fields 

4 

5from daiquiri.core.schema.component import ComponentSchema 

6from daiquiri.core.schema.validators import OneOf 

7 

8 

9METHODS = "get", "post", "patch", "delete" 

10 

11 

12class RouteSchema(Schema): 

13 name = fields.Str(required=True) 

14 methods = fields.List(OneOf(METHODS)) 

15 headers = fields.Dict() 

16 

17 

18class ProxySchema(Schema): 

19 name = fields.Str(required=True) 

20 openapi = fields.Str(required=True) 

21 target = fields.Str(required=True) 

22 routes = fields.Nested(RouteSchema, many=True) 

23 

24 

25class ProxyConfigSchema(ComponentSchema): 

26 proxies = fields.Nested(ProxySchema, many=True)