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

feat: add support for additionalProperties (#272) #273

Merged
merged 10 commits into from Oct 11, 2023

Conversation

JapuDCret
Copy link
Contributor

@JapuDCret JapuDCret commented Jan 27, 2023

Description

  • Added the ability to convert from an object with additionalProperties to a Map<String, type>
  • Created a test with different usages (String, Long, complex-type)

Related issue(s)

Resolves #272
Resolves #322

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@JapuDCret JapuDCret changed the title Feat: Add support for additionalProperties (#272) feat: Add support for additionalProperties (#272) Jan 27, 2023
@JapuDCret JapuDCret changed the title feat: Add support for additionalProperties (#272) feat: add support for additionalProperties (#272) Jan 27, 2023
@Tenischev
Copy link
Member

Hi @JapuDCret
This looks cool!
Give me some time to do a full check.

@Tenischev Tenischev self-assigned this Jan 27, 2023
@JapuDCret
Copy link
Contributor Author

Is there any update?

Copy link
Member

@Tenischev Tenischev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for such an unacceptably long delay. Please consider suggested improvements

filters/all.js Outdated
return 'Map<String, ' + _.upperFirst(_.camelCase(prop.additionalProperties().uid())) + '>';
} else if (prop.additionalProperties().format()) {
return 'Map<String, ' + toClass(toJavaType(prop.additionalProperties().format())) + '>';
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionalProperties could be boolean true|false. This else will lead to strange consequence

private @Valid Map<String, {{prop.additionalProperties().uid() | camelCase | upperFirst}}> {{propName | camelCase}};
{%- elif prop.additionalProperties().format() %}
private @Valid Map<String, {{prop.additionalProperties().format() | toJavaType | toClass}}> {{propName | camelCase}};
{%- else %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionalProperties could be boolean true|false. This else will lead to

Unable to call the return value of (prop["additionalProperties"])["type"], which is undefined or falsey

tests/mocks/map-format.yml Show resolved Hide resolved
filters/all.js Show resolved Hide resolved
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.

There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Sep 23, 2023
# Conflicts:
#	template/src/main/java/com/asyncapi/model/$$message$$.java
#	tests/__snapshots__/kafka.test.js.snap
#	tests/__snapshots__/mqtt.test.js.snap
filters/all.js Show resolved Hide resolved
@Tenischev Tenischev merged commit c44f32d into asyncapi:master Oct 11, 2023
11 checks passed
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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