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

Changed relationship representation and add multiplicity #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions swagger_to_uml.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,20 @@ def uml(self):

# required properties first
for property in sorted(self.properties, key=lambda x: x.required, reverse=True):
result += ' {property_str}\n'.format(property_str=property.uml)
if not property.ref_type:
result += ' {property_str}\n'.format(property_str=property.uml)

result += '}\n\n'

# add relationships
for relationship in sorted(self.relationships):
result += '{name} ..> {relationship}\n'.format(name=self.name, relationship=relationship)
for property in sorted(self.properties, key=lambda x: x.required, reverse=True):
if property.ref_type:
relationship = property.ref_type
property_name = property.name
if property.unique_items:
result += '{name} --> "*" {relationship} : {property_name}\n'.format(name=self.name,relationship=relationship,property_name=property_name)
else:
result += '{name} --> {relationship} : {property_name}\n'.format(name=self.name,relationship=relationship,property_name=property_name)

return result

Expand Down