Skip to content

Conversation

@altro3
Copy link
Collaborator

@altro3 altro3 commented Aug 7, 2022

Micronaut 3.6.1
Gradle 7.5.1
Groovy 3.0.12

@graemerocher
Copy link
Contributor

Could you bump the minor snapshot version? Upgrading to new minors requires a minor version bump

@altro3
Copy link
Collaborator Author

altro3 commented Aug 9, 2022

@graemerocher Sure. Done

@altro3
Copy link
Collaborator Author

altro3 commented Aug 13, 2022

@graemerocher Could you merge these changes and relese them? Want to use javadoc parser on field level, but withut these changes it doesnt wotk :-(

altro3 added 2 commits August 14, 2022 20:12
Fix wrong logic for property name when used Schema and JsonProperty annotations (fix #787)

Fix field javadoc properties parsing.

Fix invalid defaultValue and allowValues types (have always been String)

Upgrade libs:

Micronaut 3.6.0
Gradle 7.5.1
Groovy 3.0.12
@altro3 altro3 mentioned this pull request Aug 21, 2022
@altro3 altro3 changed the title Bug fixes Bug fixes. Add suport enum annotations Aug 21, 2022
@altro3 altro3 changed the title Bug fixes. Add suport enum annotations Bug fixes. Add support enum annotations Aug 21, 2022
@CLAassistant
Copy link

CLAassistant commented Aug 21, 2022

CLA assistant check
All committers have signed the CLA.

@JouperCoding
Copy link

@altro3 Not sure if this is related, however I upgrade from Micronaut 3.4.1 -> 3.6.1 just now and in 3.4.1 the Swagger generated the .yml properly with Enum examples using the @Shchema annotation.

In 3.4.1 I had the following

@Schema(implementation = CloudProvider.class,
	defaultValue = "AWS",
	example = "AWS",
	description = "" +
		"Cloud Provider." +
		"\n- AWS" +
		"<br />Amazon Web Services. " +
		"\n- AZURE" +
		"<br />Microsoft Azure cloud." +
		"\n- GCP" +
		"<br />Google Cloud Platform." +
		"\n- NA" +
		"<br />Not applicable (Self hosting site)."
)
@Validated
@Introspected
//@Serdeable
public enum CloudProvider implements Serializable {

	AWS("Amazon Web Services"),
	AZURE("Microsoft Azure"),
	GCP("Google Cloud Platform"),
	NA("Not applicable");

	private String cloudProvider;

	CloudProvider(String cloudProvider) {
		this.cloudProvider = cloudProvider;
	}

	public String getCloudProvider() {
		return cloudProvider;
	}
}

However, after upgrading to Micronaut 3.6.1 I started to see this

Error converting  [{"description":"Cloud Provider.\n- AWS<br />Amazon Web Services. \n- AZURE<br />Microsoft Azure cloud.\n- GCP<br />Google Cloud Platform.\n- NA<br />Not applicable (Self hosting site).","defaultValue":"AWS","example":"AWS"}]: to class io.swagger.v3.oas.models.media.Schema: Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('AWS')

And after some testing I had to remove all defaultValue I had defined in my @Schema for ENUMs to fix above issue.

In the PR above you mention

Fix invalid defaultValue and allowValues types (have always been String)
Fix example field with null value (always added example: null to yaml file)

Why is it always added as null to the yaml file? I believe default values was working properly as strings previously?

@altro3
Copy link
Collaborator Author

altro3 commented Aug 25, 2022

@JouperCoding Hi! Ok, got it. I'll check it on the weekend

@altro3
Copy link
Collaborator Author

altro3 commented Aug 28, 2022

@JouperCoding fixed it in this PR

@graemerocher graemerocher merged commit 2b868b8 into micronaut-projects:master Sep 1, 2022
@graemerocher
Copy link
Contributor

Sorry for the delay, was on vacation

@altro3
Copy link
Collaborator Author

altro3 commented Sep 2, 2022

@graemerocher No problem. I realized that you have a vacation according to the statistics of your activity in github ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment