asyncapi / modelina

A library for generating typed models based on inputs such as AsyncAPI, OpenAPI, and JSON Schema documents with high customization
https://modelina.org
Apache License 2.0
313 stars 183 forks source link

mergeCommonModels function doesn`t merge required field #158

Closed czlowiek488 closed 3 years ago

czlowiek488 commented 3 years ago

Describe the bug

mergeCommonModels doesn`t merge required field

How to Reproduce

use allOf with objects with required properties

Expected behavior

mergeCommonModels does merge required fields

github-actions[bot] commented 3 years ago

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup 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.

czlowiek488 commented 3 years ago

add

        if(mergeFrom.required instanceof Array) {
            mergeTo.required = [...(mergeTo.required || []), ...mergeFrom.required];
        }

to line 154 in CommonModel

jonaslagoni commented 3 years ago

Good catch @czlowiek488! Do you want to add a PR fixing this? 🙂

czlowiek488 commented 3 years ago

Sorry, I don`t have time now and in nearest future. I must finish my generator ASAP.

jonaslagoni commented 3 years ago

@czlowiek488 I provided a fix for this bug, feel free to review it if you have the time of course!

asyncapi-bot commented 3 years ago

:tada: This issue has been resolved in version 0.4.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

jonaslagoni commented 3 years ago

@all-contributors please add @czlowiek488 for bug

allcontributors[bot] commented 3 years ago

@jonaslagoni

I've put up a pull request to add @czlowiek488! :tada: