Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0397ef52

Přidáno uživatelem Michal Seják před asi 4 roky(ů)

Re #8476 - Finalized `create_certificate`. Update of swagger main.py

Zobrazit rozdíly:

swagger_server/__main__.py
6 6
from swagger_server import encoder
7 7

  
8 8

  
9
def main():
10
    app = connexion.App(__name__, specification_dir='./swagger/', debug=False)
11
    app.app.json_encoder = encoder.JSONEncoder
12
    app.add_api('swagger.yaml', arguments={'title': 'X.509 certificate management'}, base_path="/", pythonic_params=True)
13
    app.run(port=8080)
9
app = connexion.App(__name__, specification_dir='./swagger/', debug=False)
10
PORT = 8080
11

  
12

  
13
def setup(a):
14
    a.app.json_encoder = encoder.JSONEncoder
15
    a.add_api('swagger.yaml', arguments={'title': 'X.509 certificate management'}, base_path="/", pythonic_params=True)
16
    # a.run(port=PORT)
14 17

  
15 18

  
16 19
if __name__ == '__main__':
17
    main()
20
    setup(app)
21
    app.run(PORT)
swagger_server/controllers/certificates_controller.py
68 68

  
69 69
    if connexion.request.is_json:
70 70
        body = CertificateRequest.from_dict(connexion.request.get_json())  # noqa: E501
71
        if body.subject is None or body.usage is None or body.validity_days is None:
72
            return 400
71
        # if body.subject is None or body.usage is None or body.validity_days is None:
72
        #     return 400
73 73

  
74 74
        key = KEY_SERVICE.create_new_key()                              # TODO pass key
75 75
        subject = Subject(
......
176 176
    setup()                                                             # TODO remove after issue fixed
177 177

  
178 178
    if connexion.request.is_json:
179
        return 400
180 179
        filtering = Filtering.from_dict(connexion.request.get_json())  # noqa: E501
180
        print(filtering)
181
        return 200
181 182
    else:
182 183
        return 400
183 184

  

Také k dispozici: Unified diff