Skip to content

Commit 89bce0e

Browse files
author
Matheus Luís
committed
FIX: Simplify schema for ServerBasedAPIAccessControl to optionally accept base_url
the proposed discriminated union was not working and would require the creation of a subschema inside this schema, so for simplicity if base_url is included it takes priority over the server+port defaults
1 parent 4a3910f commit 89bce0e

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

bluesky_httpserver/authorization/api_access.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -461,34 +461,26 @@ def __init__(self, *, roles=None, users=None):
461461

462462

463463
_schema_ServerBasedAPIAccessControl = """
464-
$schema": http://json-schema.org/draft-07/schema#
464+
$schema": http://json-schema.org/draft-07/schema
465465
type: object
466466
additionalProperties: false
467467
properties:
468468
instrument:
469469
type: string
470-
roles: # Detailed validation is performed elsewhere
470+
roles:
471471
description: The value is passed to BasicAPIAccessControl object
472-
oneOf:
473-
- properties:
474-
base_url:
475-
type: string
476-
required:
477-
- base_url
478-
- properties:
479-
server:
480-
type: string
481-
port:
482-
type: integer
483-
required:
484-
- server
485-
- port
486472
update_period:
487473
type: integer
488474
expiration_period:
489475
type: [integer, "null"]
490476
http_timeout:
491477
type: integer
478+
server:
479+
type: string
480+
port:
481+
type: integer
482+
base_url:
483+
type: [string, "null"]
492484
"""
493485

494486

0 commit comments

Comments
 (0)