Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular references require output directory error #1638

Open
yogeshVU opened this issue Oct 23, 2023 · 1 comment
Open

Modular references require output directory error #1638

yogeshVU opened this issue Oct 23, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@yogeshVU
Copy link

yogeshVU commented Oct 23, 2023

Describe the bug
When working with a jsonschema and invoking the model generator, one encounters following error:

Modular references require an output directory, not a file

It appears that the naming causes this error
"title": "GenomeStudio 2.0 - Methylation Module",

To Reproduce

Example schema:

{
  "title": "test",
  "type": "object",
  "properties": {
"Liquid Biomarkers Input Data": {
      "type": "object",
      "properties": {
                "Methylomics": {
          "title": "Methylomics",
          "type": "object",
          "properties": {
            "Software": {
              "title": "Software",
              "type": "object",
              "anyOf": [
                {
                  "title": "GenomeStudio 2.0 - Methylation Module",
                  "type": "object",
                  "properties": {
                    "GenomeStudio": {
                      "title": "GenomeStudio",
                      "type": "object",
                      "properties": {},
                      "required": [],
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }

              ]
            }

          },
          "required": [],
          "additionalProperties": false
        }
      },
      "required": []
    }
  },
  "additionalProperties": false,
  "required": []
}

Used commandline:

$ datamodel-codegen --use-annotated --use-title-as-name --use-subclass-enum --disable-appending-item-suffix --input-file-type jsonschema  --input EnigmaContentModel.json --output testEnigmaModel.py --output-model-type pydantic_v2.BaseModel --allow-population-by-field-name --snake-case-field

Expected behavior
Should not produce any modular reference errors.

Version:

  • OS: [e.g. iOS] macOS
  • Python version: 3.10
  • datamodel-code-generator version: [e.g. 22] 0.22

Additional context
Changing the tittle to simple naming eliminates the issue: such as "title": "GenomeStudio",
So basically removing . from the title does not produce this bug

@koxudaxi
Copy link
Owner

koxudaxi commented Nov 8, 2023

Thank you for creating the PR.
I guess some users may use the . in the title. it's to define a model as a module 🤔
Should we provide the option to strip . from the title?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants