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

fix: when there are no schema properties, we add 'pass' to the constructor #85

Merged
merged 4 commits into from Oct 20, 2021

Conversation

damaru-inc
Copy link
Contributor

Description

In cases where a schema has no properties, the model class ends up with a constructor looking like this:

def __init__ (self):

which is invalid. This fix adds 'pass' :
def init (self):
pass

Related issue(s)
Fixes #60

@@ -27,8 +27,9 @@
):
{%- for name, prop in properties -%}
{%- set typeInfo = [name, prop] | getTypeInfo %}
{{ indent3}}self.{{typeInfo.pythonName}} = {{typeInfo.pythonName}}
{{ indent3 }}self.{{typeInfo.pythonName}} = {{typeInfo.pythonName}}

Choose a reason for hiding this comment

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

Is there a reason there are spaces around indent3 and not around typeInfo.pythonName? If not, I suggest we add the spaces in for consistency.

@sonarcloud
Copy link

sonarcloud bot commented Oct 19, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@damaru-inc
Copy link
Contributor Author

I still can't merge this. I was reading up on codeowners and found this: "The people you choose as code owners must have write permissions for the repository." I'm not sure if Cameron or I have write permission.

https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

@derberg
Copy link
Member

derberg commented Oct 20, 2021

@damaru-inc the reason is that @CameronRushton did not yet accept an email invitation to have Maintainer rights in this repo. For now, he is considered by the system to be outsider (that sounds odd 😄 ) and this is why his approval "doesn't count".

@damaru-inc damaru-inc merged commit d58553d into asyncapi:master Oct 20, 2021
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.2.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

@damaru-inc damaru-inc deleted the issue/60-empty-schema branch October 20, 2021 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to run generated code
5 participants