APIs-guru / google-discovery-to-swagger

Script for converting Google Discovery format into OpenAPI (swagger) 3.0
MIT License
57 stars 16 forks source link

Generate a root level tags property #8

Closed crankydillo closed 8 years ago

crankydillo commented 8 years ago

The code generates a tag at the operation level. I'm under the impression there's a general expectation these refer to a root-level tags property, which contains more information (as in petstore spec).

What do you think?

I'd be willing to write the code if you think it should be done.

IvanGoncharov commented 8 years ago

@crankydillo You right. Swagger allow operations tags not marked on top-level, but I think it's good idea to also have them on top-level.

I'd be willing to write the code if you think it should be done.

It's pretty easy to add, so I will add this today :)

P.S. You try to convert one of Google's API spec? If so please check my main project. Or it some other API documented in this format? If it public, can you please share the links?

crankydillo commented 8 years ago

woops, I didn't mean to do that:)

crankydillo commented 8 years ago

Sorry, but the specs I'm working on are private-ish.

IvanGoncharov commented 8 years ago

No problem. When I wrote this converter I didn't expect that somebody outside of Google use it to document APIs :)

crankydillo commented 8 years ago

I think my company may have come to that conclusion as well:)

IvanGoncharov commented 8 years ago

@crankydillo Please test it and reopen if needed.

crankydillo commented 8 years ago

Preliminary testing looks good. If I come across any issues with this, I'll let you know.

crankydillo commented 8 years ago

Wait, preliminary testing may not look good:) I believe you might be duplicating tags if there are multiple paths for the same resource. I don't mind submitting tests with issues, and as I've hinted, my team is looking to help with this tool.

How do you feel about unit testing? Do you have a preference? I'm a fan of mocha + chai (expect variant), but I'll use what you prefer. This is a sample of my typical style. I should note that I'm more of a Java/Scala guy, so I tend to use the functional programming capabilities of JS as compared to its OO (prototype) capabilities.

IvanGoncharov commented 8 years ago

@crankydillo Sorry, for some reason missed email notification.

I will look into duplication issue, it should be very simple fix with LoDash.

How do you feel about unit testing?

:+1: In my use case I'm focused only Google's specs, so unit-test can allow me to also consider 3rd-party spec during development.

I'm a fan of mocha + chai (expect variant), but I'll use what you prefer.

I'm new to JS(< 1year), and only thing that a worked with is mocha + chai. So it totally ok for me.

This is a sample of my typical style

Look good, except two things:

so I tend to use the functional programming capabilities of JS as compared to its OO

Same here, I can't leave without LoDash :)

IvanGoncharov commented 8 years ago

@crankydillo Sorry totally forget to remove duplicate tags. Fixed in cf293aff60f41ece67f0df62c0769c6e7d3c9297