json-schema-for-humans icon indicating copy to clipboard operation
json-schema-for-humans copied to clipboard

Check for absolute paths provided in the argument

Open fhalde opened this issue 1 year ago • 0 comments

I was trying to use the generate-schema-docs cli in the following way

generate-schema-docs <(k get crd kafkaconnects.kafka.strimzi.io -o json | jq '.spec.versions[0].schema.openAPIV3Schema.properties.spec' -o json)

but this kept failing with

Traceback (most recent call last):
  File "/opt/homebrew/bin/generate-schema-doc", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/json_schema_for_humans/cli.py", line 71, in main
    schemas_to_render = get_schemas_to_render_from_cli_arguments(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/json_schema_for_humans/cli.py", line 88, in get_schemas_to_render_from_cli_arguments
    schemas_to_render += get_schemas_to_render(schema_file_or_dir_part, result_output, result_extension)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/json_schema_for_humans/schema/schema_importer.py", line 36, in get_schemas_to_render
    schema_file_paths = _get_schema_paths(schema_file_or_dir)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/json_schema_for_humans/schema/schema_importer.py", line 21, in _get_schema_paths
    schema_file_paths += [schema_path for schema_path in Path.cwd().glob(str(schema_file_or_dir))]
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/json_schema_for_humans/schema/schema_importer.py", line 21, in <listcomp>
    schema_file_paths += [schema_path for schema_path in Path.cwd().glob(str(schema_file_or_dir))]
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py", line 949, in glob
    raise NotImplementedError("Non-relative patterns are unsupported")
NotImplementedError: Non-relative patterns are unsupported

fhalde avatar Jan 26 '24 13:01 fhalde