Code Monkey home page Code Monkey logo

swagger_to_uml's Issues

Handling allOf for Dog and Cat types of Pet

Extended Pet example to include Cat and Dog using allOf example from here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

Get the following error:

`python swagger_to_uml.py swagger.json > swagger.puml
required key "type" not found in dictionary {"description": "A representation of a cat", "allOf": [{"$ref": "#/definitions/Pet"}, {"type": "object", "properties": {"huntingSkill": {"type": "string", "description": "The measured skill for hunting", "default": "lazy", "enum": ["clueless", "lazy", "adventurous", "aggressive"]}}, "required": ["huntingSkill"]}]}
Traceback (most recent call last):
File "swagger_to_uml.py", line 380, in
sw = Swagger.from_file(input_file_name)
File "swagger_to_uml.py", line 367, in from_file
return Swagger.from_dict(loader(fd))
File "swagger_to_uml.py", line 357, in from_dict
definitions = [Definition.from_dict(name, definition) for name, definition in d.get('definitions',{}).items()]
File "swagger_to_uml.py", line 357, in
definitions = [Definition.from_dict(name, definition) for name, definition in d.get('definitions',{}).items()]
File "swagger_to_uml.py", line 204, in from_dict
type=d['type'],
KeyError: 'type'

Modified swagger attached

swagger.json.txt

Syntax error

Hi

I get this syntax error in plantuml :
swagger-PB360

Do you have an idea how to solve it ?

Best regards
Jean Marc

Python erros

Hi
I tried to run python part of processing calling

python swagger_to_uml.py petstore_example/swagger.json >petstore_example/swagger.puml

and i got message like this

  "File "swagger_to_uml.py", line 376
    print(sw.uml, end='', flush=True)"

Do you have idea what I'm doing wrong ? :)

Thanks for info :-)

Best regards

$ref not found and Yaml Extension

I get this error:

Traceback` (most recent call last):
  File "swagger_to_uml.py", line 380, in <module>
    sw = Swagger.from_file(input_file_name)
  File "swagger_to_uml.py", line 367, in from_file
    return Swagger.from_dict(loader(fd))
  File "swagger_to_uml.py", line 357, in from_dict
    definitions = [Definition.from_dict(name, definition) for name, definition in d.get('definitions',{}).items()]
  File "swagger_to_uml.py", line 357, in <listcomp>
    definitions = [Definition.from_dict(name, definition) for name, definition in d.get('definitions',{}).items()]
  File "swagger_to_uml.py", line 197, in from_dict
    required=property_name in d.get('required', [])
  File "swagger_to_uml.py", line 103, in from_dict
    items = resolve_ref(type_dict['items']['$ref'])
KeyError: '$ref'

Fixed:

c103
<                 items = resolve_ref(type_dict['items']['$ref']) if '$ref' in type_dict['items'] else None
c364
<         if filename.endswith('.yml') or filename.endswith('.yaml'):

Sorry cant do pull req due to ... policy

Update README Please

Hello, I really appreciate this tool. Since the python script was converted to shell script with setup it no longer works for me or I do not understand how to use it. I reverted to older version and was able to use it with the script. When you have time can you please update the README to explain how to use this with the new shell script. Thank you!

Does not follow html $ref

Path is replaced with $ref to an openapi yaml stored html.

Example:
paths:
/:
$ref: 'https://artifactory.mycompany.com/artifactory/maven/com/apis/common/0.1.0-20210924151918/common-0.1.0-20210924151918.yaml#/paths/New'
/instances:
$ref: 'https://artifactory.mycompany.com/artifactory/maven/com/apis/common/0.1.0-20210924151918/common-0.1.0-20210924151918.yaml#/paths/GetInstanceIds'

swagger_to_uml throws the following error
Traceback (most recent call last):
File "C:/Users/212708371/Documents/Gitlab/build-util/swagger_to_uml.py", line 367, in from_file
return Swagger.from_dict(loader(fd))
File "C:/Users/212708371/Documents/Gitlab/build-util/swagger_to_uml.py", line 357, in from_dict
paths = [Path.from_dict(d, path_name, path) for path_name, path in d['paths'].items()]
File "C:/Users/212708371/Documents/Gitlab/build-util/swagger_to_uml.py", line 357, in
paths = [Path.from_dict(d, path_name, path) for path_name, path in d['paths'].items()]
File "C:/Users/212708371/Documents/Gitlab/build-util/swagger_to_uml.py", line 336, in from_dict
operations=[Operation.from_dict(whole, path_name, t, op, parameters) for t, op in d.items() if t not in ['parameters', 'summary', 'description']]
File "C:/Users/212708371/Documents/Gitlab/build-util/swagger_to_uml.py", line 336, in
operations=[Operation.from_dict(whole, path_name, t, op, parameters) for t, op in d.items() if t not in ['parameters', 'summary', 'description']]
File "C:/Users/212708371/Documents/Gitlab/build-util/swagger_to_uml.py", line 286, in from_dict
summary=d.get('summary'),

I am assuming that it would also throw errors for my Parameters and Schemas which also reference html but it fails before getting to those

masking of invalid chars in puml

If there are plus chars in the name of an entity, they are not correctly masked.

workaround:

sed -i 's#\([^ ]*[+][^ ]*\)#"\1"#g' swagger.puml

before image creation

allOf not handled in Items

Hello,

I need to define property UnitGameSystem.profiles with an array of multiple type of object ProfileXXX whish are inherited of object Profile

...
  UnitGameSystem:
    properties:
      id:
        type: string
      name:
        type: string
      profiles:
        items:
          allOf:
            - $ref: '#/definitions/ProfileAOS4'
            - $ref: '#/definitions/ProfileWFB9'
            - $ref: '#/definitions/ProfileWFB12'
            - $ref: '#/definitions/ProfileWHQ'
            - $ref: '#/definitions/ProfileT9A12'
        type: array
...

I have an error for this definition

d:\PROJECTS\swagger_to_uml>python swagger_to_uml.py fantasy-battle-db.swagger.json > fantasy-battle-db.puml
Traceback (most recent call last):
  File "d:\PROJECTS\swagger_to_uml\swagger_to_uml.py", line 380, in <module>
    sw = Swagger.from_file(input_file_name)
  File "d:\PROJECTS\swagger_to_uml\swagger_to_uml.py", line 367, in from_file
    return Swagger.from_dict(loader(fd))
  File "d:\PROJECTS\swagger_to_uml\swagger_to_uml.py", line 356, in from_dict
    definitions = [Definition.from_dict(name, definition) for name, definition in d.get('definitions',{}).items()]
  File "d:\PROJECTS\swagger_to_uml\swagger_to_uml.py", line 356, in <listcomp>
    definitions = [Definition.from_dict(name, definition) for name, definition in d.get('definitions',{}).items()]
  File "d:\PROJECTS\swagger_to_uml\swagger_to_uml.py", line 193, in from_dict
    properties.append(Property.from_dict(
  File "d:\PROJECTS\swagger_to_uml\swagger_to_uml.py", line 102, in from_dict
    items = resolve_ref(type_dict['items']['$ref'])
KeyError: '$ref'

full json is : fantasy-battle-db.swagger.json.txt

Thank's you

PyPI

This tool doesnt appear to be on PyPI yet.

JSON Schema Support

Hi I was used to use this good tool some year ago to fully document my APIs

What about JSON Schema support ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.