LiveRamp / reslang

A language for describing resource-oriented APIs & turning them into Swagger or resource diagrams. Oriented around the concepts we want to expose in the APIs.
Apache License 2.0
23 stars 7 forks source link

APIE-2: Parse operation summary from comment #206

Closed nhtzr closed 3 years ago

nhtzr commented 3 years ago

Issue: https://github.com/LiveRamp/reslang/issues/204 Jira: APIE-2 See disc at https://liveramp.slack.com/archives/CPBAEKS9X/p1617655195082200 Openapi spec: https://swagger.io/specification/#operation-object

Changes:

ops-github-DU4JOAWE commented 3 years ago

This change is Reviewable

nhtzr commented 3 years ago

@njaczko

why did you choose to go with this approach

~I saw adding more syntax as too busy for what amounts to be the title of the operation description, and the quoted comments already contained a summary line at the beginning of the desciption in the current api-specs folders. So I felt that keeping that coupled info together clicked more easily to whoever was writing it. I also got confident in the approach because See docs: was already doing something similar for descriptions, although I admit see docs: logic looks like scope creep somewhat lol.~

Nvm! I moved the logic to be part of the pegjs code. Also I saw what you meant with description vs comment. Summary: is now an optional line at the beginning of the description block for an operation (and now I understand that description block happened to be labeled as comment there)

I'm also not in love with how many different ways there are for summaries to be set. We have multiple layers of default behavior, which makes the final summary a little bit unpredictable.

Right, I tried accommodating the existing api-specs files, but it might end up only being confusing. I'll remove those fallbacks and leave only the explicit Summary: approach.

If someone includes a Summary: blah blah line at the beginning of their description, does it also show up in the description?

It shouldn't, but I'll add test cases for it.

nhtzr commented 3 years ago
image

As asked by sirisha, including test output and merging to release branch