| 1927 | |
| 1928 | class OpenApi: |
| 1929 | def __init__(self, args: argparse.Namespace): |
| 1930 | self.args = args |
| 1931 | self.subcommand = args.subcommand |
| 1932 | self.dry_run = args.dry_run |
| 1933 | self.verbose = args.verbose |
| 1934 | |
| 1935 | index = ( |
| 1936 | OpenApi.read_json(args.index_filename) if self.subcommand != "index" and "index_filename" in args else {} |
| 1937 | ) |
| 1938 | self.classes = index.get("classes", {}) |
| 1939 | self.schema_to_class = index.get("indices", {}).get("schema_to_classes", {}) |
| 1940 | self.schema_to_class["default"] = ["GithubObject"] |
| 1941 | self.spec = OpenApi.read_json(args.spec) if "spec" in args and self.subcommand not in ["fetch", "index"] else {} |
| 1942 | self.ignored_schemas = set(index.get("config", {}).get("ignored_schemas", {})) |
| 1943 | |
| 1944 | def as_python_type( |
| 1945 | self, |