kaxil commented on issue #43378: URL: https://github.com/apache/airflow/issues/43378#issuecomment-2766662488
I was trying out few tools to compare `v1` and `v2` specs. v1: https://github.com/apache/airflow/blob/2.10.5/airflow/api_connexion/openapi/v1.yaml v2: http://localhost:28080/openapi.json (from local) I used the following script to normalize the spec: ```python import sys import yaml def normalize(filename: str, version_prefixes=("/api/v1", "/api/v2")): with open(filename) as f: spec = yaml.safe_load(f) new_paths = {} for path, val in spec.get("paths", {}).items(): for prefix in version_prefixes: if path.startswith(prefix): path = path[len(prefix):] new_paths[path or "/"] = val spec["paths"] = new_paths spec.pop("servers", None) output_file = filename.replace(".yaml", "-normalized.yaml").replace(".json", "-normalized.yaml") with open(output_file, "w") as f: yaml.safe_dump(spec, f) print(f"Normalized: {filename} → {output_file}") if __name__ == "__main__": for file in sys.argv[1:]: normalize(file) ``` and then ran: ``` ❯ docker run --rm -v ${PWD}:/spec openapitools/openapi-diff /spec/v1-normalized.yaml /spec/v2-normalized.yaml ``` I tried with the following 2 tools: - https://github.com/OpenAPITools/openapi-diff - https://github.com/oasdiff/oasdiff -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
