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

"Path not present" error when processing multiple JSON files having objects with the same name #1427

Closed
tokarenko opened this issue Aug 11, 2022 · 0 comments · Fixed by #1484
Labels
Milestone

Comments

@tokarenko
Copy link

tokarenko commented Aug 11, 2022

jsonschema2pojo 1.1.2 fails with "Path not present: watcher" error when processing multiple json files having objects with the same name, e.g.:

... and the following configuration:

    <plugins>
        <plugin>
            <groupId>org.jsonschema2pojo</groupId>
            <artifactId>jsonschema2pojo-maven-plugin</artifactId>
            <version>1.1.2</version>
            <configuration>
                <generateBuilders>true</generateBuilders>
                <includeToString>false</includeToString>
                <includeHashcodeAndEquals>false</includeHashcodeAndEquals>
                <annotationStyle>none</annotationStyle>
                <includeAdditionalProperties>false</includeAdditionalProperties>
                <initializeCollections>false</initializeCollections>
            </configuration>
            <executions>
                <execution>
                    <id>execution-with-error</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                         <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
                         <sourceType>json</sourceType>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

The error persists if I move json-files into different subdirectories of "sourceDirectory". I expect that json-files in different subdirectories will result in POJOs with different packages to avoid naming conflicts.

unkish added a commit to unkish/jsonschema2pojo that referenced this issue Jan 18, 2023
@unkish unkish added the bug label Jan 18, 2023
unkish added a commit to unkish/jsonschema2pojo that referenced this issue Jan 22, 2023
unkish added a commit to unkish/jsonschema2pojo that referenced this issue Jan 26, 2023
@joelittlejohn joelittlejohn changed the title jsonschema2pojo 1.1.2 fails with "Path not present: watcher" error when processing multiple json files having objects with the same name "Path not present" error when processing multiple JSON files having objects with the same name Jan 26, 2023
@joelittlejohn joelittlejohn added this to the 1.1.4 milestone Jan 26, 2023
unkish added a commit to unkish/jsonschema2pojo that referenced this issue Feb 15, 2023
joelittlejohn added a commit that referenced this issue Feb 15, 2023
When using JSON or YAML files (not schemas, but example data) the
schemas will not have a proper file path in their ID, as there is no
actual schema file. All schema IDs will be fragments only (relative
references within the document). Once generation is complete for a file,
these schemas should be thrown away and not reused.

Closes #1427
joelittlejohn added a commit that referenced this issue Feb 16, 2023
When using JSON or YAML files (not schemas, but example data) the
schemas will not have a proper file path in their ID, as there is no
actual schema file. All schema IDs will be fragments only (relative
references within the document). Once generation is complete for a file,
these schemas should be thrown away and not reused.

Closes #1427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants