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

Adding a simple first version of an ongoing shaping OAS3 spec #1775

Merged
merged 2 commits into from
Apr 2, 2020

Conversation

didierofrivia
Copy link
Member

@didierofrivia didierofrivia commented Mar 13, 2020

In order to not only shaping but documenting the API endpoints we need to hydrate PortaFly, we need to use as base an OAS. This will also serve as a testing tool and development used as mocked data.
This PR also solves the first specification needed for Account > List

This spec is created with Apicurio and it's meant to be edited with it. More info in https://www.apicur.io/

What this PR does / why we need it:

Introduces an Open API Specification and address the specification needs described in https://issues.redhat.com/browse/THREESCALE-4731

Which issue(s) this PR fixes

https://issues.redhat.com/browse/THREESCALE-4711
https://issues.redhat.com/browse/THREESCALE-4731

BASED ON https://marvelapp.com/55343de/screen/67190787

How it looks
Screenshot 2020-03-19 at 14 41 57

Special notes for your reviewer:
PLEASE, READ THE ISSUES ATTACH TO UNDERSTAND THIS PR, THERE'S DEFINITION OF WHAT'S NEEDED First @hallelujah comment is obsolete, those issues are meant to cover what he expressed there.

And if you want to see the responses, etc... you might want to check it in online spec docs like redoc or locally with said tool

Copy link
Contributor

@hallelujah hallelujah left a comment

Choose a reason for hiding this comment

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

I would like to know what this is solving. I mean those are responses but it is not solving anything in particular, it is a general description of something to expect (but what is this something?)

Specification

We need a general specification in order to know what we will need in those OAS 3.0 specifications
Example:

  • I would like to display a list of applications in the page
  • In this page I see: Contract name, contracted date, service name, service description in a tooltip, link to the service, link to the contract edit, link to the plan, what else?

Implementation

Then you come up with some implementations for the API

Solution 1

Discuss what you need inside, will implement in each of the OAS 3.0 specs for the purpose of the UI
Maybe some fields make sense to put inside the Entity even though they can be retrieved by another endpoint. E.g. the plan name (I do not know, it is an example)

  • Contract is described like make your OAS 3.0 specification with those fields

    • id
    • name
    • subscribed_service_id
    • contractor_account_id The Account who contracted the plan
    • plan_id The contracted plan
    • plan_type The plan type
    • contracted_account_id The Account who created the contracted plan
    • contract_type The type of contract (Application,
  • Service is described like make your OAS 3.0 specification

    • etc ...
  • Plan is described like make your OAS 3.0 specification

    • etc ...

Use of Porta API

We can use the following Porta API endpoints:

  • /admin/api/applications
  • /admin/api/services
  • etc ...

Raise issues:

  • But those API are not returning the response we want.
    We will need to compose those API response
  • Evaluate the complexity and where to do it:
    • It will be easier if we do it in BFF, why? how?
    • It will be easier if we do it directly in JS for now, separating the composition with the responses
    • It will be really easy to do it in Porta directly, why? how?

Evaluate the complexity of crafting the response described above

Solution 2

You decide not to put those fields inside the Contract, but then describe how you can retrieve them
and raise the potential issues like above.

Decide on an implementation

Raise issues and try to solve solution for each raised issues.
Then go for it the OAS 3.0 description and the code.

Notes

Right now we have contract instead of application.

Type Description Reference
Contract Meta class for all types of contracts Plan (Meta class)
Cinstance The actual application ApplicationPlan
ServiceContract A type of contract by Service ServicePlan
AccountContract A type of contract by Account AccountPlan

portafly/portafly_api.yml Outdated Show resolved Hide resolved
portafly/portafly_api.yml Outdated Show resolved Hide resolved
@didierofrivia didierofrivia force-pushed the portafly/THREESCALE-4711_oas_spec branch 2 times, most recently from 6432b1c to 7625a4b Compare March 18, 2020 11:08
@didierofrivia didierofrivia changed the title [wip] Adding a simple first version of an ongoing shaping OAS3 spec Adding a simple first version of an ongoing shaping OAS3 spec Mar 19, 2020
@josemigallas josemigallas force-pushed the portafly/THREESCALE-4711_oas_spec branch from 7625a4b to 48a135a Compare March 20, 2020 12:15
@josemigallas
Copy link
Contributor

Rebased

@josemigallas josemigallas added the portafly Issues related to the PortaFly module label Mar 20, 2020
@didierofrivia didierofrivia force-pushed the portafly/THREESCALE-4711_oas_spec branch from 48a135a to 33c7a0b Compare March 23, 2020 03:47
josemigallas
josemigallas previously approved these changes Mar 25, 2020
description: The organization name
type: string
admin_name:
description: The name of the admin user
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure you'll only need the name of the user? Maybe a link to the user instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Given the design in https://issues.redhat.com/browse/THREESCALE-4725, only the name is needed. No link for the admin user. It might be needed for the organization link that links to the account, which is not yet created. I thought about expanding the spec as we are building new resources. Does that make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it makes sense, yes.

@didierofrivia didierofrivia merged commit c67d5d8 into master Apr 2, 2020
@hallelujah hallelujah deleted the portafly/THREESCALE-4711_oas_spec branch September 2, 2021 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
portafly Issues related to the PortaFly module
Projects
None yet
5 participants