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

Error DCSA Interface Standard for electronic Bill of Lading #380

Open
Atroooo opened this issue Sep 20, 2024 · 7 comments
Open

Error DCSA Interface Standard for electronic Bill of Lading #380

Atroooo opened this issue Sep 20, 2024 · 7 comments

Comments

@Atroooo
Copy link

Atroooo commented Sep 20, 2024

Hi,

I don't know where I should ask my question, please tell me if I need to do it somewhere else.

I've been trying to implement the DCSA_EBL 3.0.0 using swagger yml in Java Springboot.
When I run mvn clean install I got errors in the generated sources :

[ERROR] .../target/generated-sources/openapi/src/main/java/com/baeldung/openapi/model/UTEquipmentReference.java:[29,8] com.baeldung.openapi.model.UTEquipmentReference is not abstract and does not override abstract method getIsShipperOwned() in com.baeldung.openapi.model.UtilizedTransportEquipmentShipper

[ERROR] .../target/generated-sources/openapi/src/main/java/com/baeldung/openapi/model/UTEquipmentReference.java:[72,18] getIsShipperOwned() in com.baeldung.openapi.model.UTEquipmentReference cannot implement getIsShipperOwned() in com.baeldung.openapi.model.UtilizedTransportEquipmentShipper
return type @javax.validation.constraints.NotNull java.lang.Boolean is not compatible with java.lang.String

[ERROR] .../target/generated-sources/openapi/src/main/java/com/baeldung/openapi/model/UTEquipment.java:[30,8] com.baeldung.openapi.model.UTEquipment is not abstract and does not override abstract method getIsShipperOwned() in com.baeldung.openapi.model.UtilizedTransportEquipmentShipper

[ERROR] .../target/generated-sources/openapi/src/main/java/com/baeldung/openapi/model/UTEquipment.java:[73,18] getIsShipperOwned() in com.baeldung.openapi.model.UTEquipment cannot implement getIsShipperOwned() in com.baeldung.openapi.model.UtilizedTransportEquipmentShipper
return type @javax.validation.constraints.NotNull java.lang.Boolean is not compatible with java.lang.String

This is the part where I'm executing the yml in my pom.xml

<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.openapitools</groupId>
				<artifactId>openapi-generator-maven-plugin</artifactId>
				<version>7.1.0</version>
				<executions>
					<execution>
						<id>DCSA_EBL_v3</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>
								${project.basedir}/src/main/resources/contracts/DCSA_EBL_v3.yml
							</inputSpec>
							<generatorName>spring</generatorName>
							<apiPackage>com.baeldung.openapi.api</apiPackage>
							<modelPackage>com.baeldung.openapi.model</modelPackage>
							<supportingFilesToGenerate>
								ApiUtil.java
							</supportingFilesToGenerate>
							<configOptions>
								<delegatePattern>true</delegatePattern>
							</configOptions>
						</configuration>
					</execution>
				</executions>
			</plugin>

In every versions that I've tried (2.0.0 and different 3.0.0-beta versions) I still got errors in the generated sources.
I wonder if it's coming from my java version or anything else.
Have you ever heard of this kind of problems ? Do you know how to fix it ?

Thanks !

@HenrikHL
Copy link
Contributor

Hi @Atroooo,

It is quite some time since i last did some SpringBoot coding - but looking at your errors it looks like it is interpreting isShipperOwned as a String where it in fact is a Boolean. @preetamnpr or @palatsangeetha do you have any suggestion as to what is wrong?

@HenrikHL
Copy link
Contributor

Looking at it again it seems my first impression was wrong - I think it doesn't work because of a oneOf construction. Not sure how that is solved...

@Atroooo
Copy link
Author

Atroooo commented Sep 21, 2024

Hi,

Thanks for your answers.
The thing is, if I modify the generated code, every time I run mvn install, the files that I modify get reset.
Also I'm not even using yet the functions that are causing troubles.

@jkosternl
Copy link
Collaborator

Hi @Atroooo, if you use code generation, always put the generated code in a sub folder of the target folder.
For example, have it generated to ${project.build.directory}/generated-sources/openapi</sourcepath>
In that way, you prevent changes in production code in every build.

After typing this, I looked up your used plugin and see that the configuration parameter output by default does this behaviour. See https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin

Otherwise, if you want to have it generated only once, so you can make changes in the generated code: enable the plugin, generate it, store it in your source folder (and in git), and disable the plugin again.

Small advice, don't use install when not needed. You can use mvn package to have everything generated as well, I guess.

@Atroooo
Copy link
Author

Atroooo commented Sep 23, 2024

Hi,

Thanks for you answer.

For the generated code I'm already doing that I just replaced the actual path with "..." instead to make the first message clearer, I don't know if it was a good idea.

I'll check the link you provided it seems to have a lot of parameters that I didn't know about.

And I'll fix the generated code and not generate it again to keep the fix I guess. It's still strange that I've got those errors when I install it.

Anyways thanks for the advices !

@jkosternl
Copy link
Collaborator

You're right on the fact that the errors should appear during the generation. I don't know where they come from and I need to reproduce this myself, in order to investigate it, which takes some time.
If it is easy to fix the code yourself, and then you can use the generated code, it is probably fine for now.

The whole idea of your project is to generate a Java client, which can send data to an EBL endpoint?

I don't understand your sentence on "already doing that I just replaced the actual path with "..." instead". Where exactly is it?

@Atroooo
Copy link
Author

Atroooo commented Sep 23, 2024

The generated code is already in a sub folder of the target folder, but I misread your answer sorry.

The idea of the project is to make a SaaS that implements the DCSA standards for the eBL to allow shipping compagny and other actors to create and manage their contracts.

If you need anything to reproduce the errors, feel free to ask me !

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

No branches or pull requests

3 participants