def generate(args=None): if args is None: args = [None] endpoint: Endpoint for endpoint in ENDPOINT_REGISTRY: try: SPEC.path( path=endpoint.path, operations=endpoint.to_operation_dict(), ) except TypeError: print(endpoint, file=sys.stderr) raise # NOTE: deepcopy the dict because validate_spec modifies the SPEC in-place, leaving some # internal properties lying around, which leads to an invalid spec-file. check_dict = copy.deepcopy(SPEC.to_dict()) validate_spec(check_dict) if args[-1] == '--json': output = json.dumps(SPEC.to_dict(), indent=2).rstrip() else: output = SPEC.to_yaml().rstrip() return output
def generate(): # We need to import the endpoints before importing the spec, lest we don't have a guarantee that # all endpoints will be registered in the spec as this is done at import-time. import cmk.gui.plugins.openapi.endpoints # pylint: disable=unused-import,unused-variable # NOTE: deepcopy the dict because validate_spec modifies the SPEC in-place, leaving some # internal properties lying around, which leads to an invalid spec-file. check_dict = copy.deepcopy(SPEC.to_dict()) validate_spec(check_dict) return SPEC.to_yaml().rstrip()
def generate(args=None): if args is None: args = [None] # NOTE: deepcopy the dict because validate_spec modifies the SPEC in-place, leaving some # internal properties lying around, which leads to an invalid spec-file. check_dict = copy.deepcopy(SPEC.to_dict()) validate_spec(check_dict) if args[-1] == '--json': output = json.dumps(SPEC.to_dict(), indent=2).rstrip() else: output = SPEC.to_yaml().rstrip() return output
def generate(args=None): if args is None: args = [None] # We need to import the endpoints before importing the spec, lest we don't have a guarantee that # all endpoints will be registered in the spec as this is done at import-time. import cmk.gui.plugins.openapi.endpoints # pylint: disable=unused-import,unused-variable # NOTE: deepcopy the dict because validate_spec modifies the SPEC in-place, leaving some # internal properties lying around, which leads to an invalid spec-file. check_dict = copy.deepcopy(SPEC.to_dict()) validate_spec(check_dict) if args[-1] == '--json': output = json.dumps(SPEC.to_dict(), indent=2).rstrip() else: output = SPEC.to_yaml().rstrip() return output