Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

OpenAPI/Swagger #15

Open
2 of 5 tasks
PhearZero opened this issue Sep 8, 2019 · 1 comment
Open
2 of 5 tasks

OpenAPI/Swagger #15

PhearZero opened this issue Sep 8, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request
Projects

Comments

@PhearZero
Copy link
Contributor

PhearZero commented Sep 8, 2019

🚀 Feature Proposal

Introduce a Single Source of Truth between all modules via Swagger/OpenAPI and JSON Schema specification

Motivation

Open Closed and Substitution Principles. All packages must share common interfaces in order to ensure API compatibility for internal/external projects. We can EYODF by providing a shared interface #12 that is generated via a standard specification. This way each module can extend | override from the base model | service in order to preform module requirements.

Possible Generators:

OpenAPI Isomorphic Models

Generated to ./packages/core/model

// In Component
import {User} from '@hospitalrun-org/core'
export default class MyComponent<User> {}

OpenAPI Isomorphic Services

Generated to ./packages/core/services

// Consume Service
import {UserService} from '@hospitalrun-org/core'
let user = UserService.operationId({...})

Fastify Decorators and Routes

Generated to ./packages/server/(plugins & services)

// Generates Decorators that look similar to:
import {UserService} from '@hospitalrun-org/core'
fastify.decorate(operationId, UserService.operationId)

// All route based services look similar to:
import {User} from '@hospitalrun-org/core'
fastify.post('/users', (request,reply)=> {reply.send( fastify.operationId(instanceof User))} )

React Router with Store integration

Generated to ./packages/frontend/(tabs || pages)

// Example component
import {UserService, User} from '@hospitalrun-org/core'
import * as React from 'react'
export default class UserPage extends React.Component {
  render(){
        <HighLevelPage service={UserService} model={User}/>
  }
}

// Example Router
import UserPage from './pages/UserPage'

const routes =  [
  {
    path: '/user',
    exact: true,
    component: UserPage,
  }
]
export default routes

Blocking Issues:

@PhearZero PhearZero added the enhancement New feature or request label Sep 8, 2019
@PhearZero PhearZero self-assigned this Sep 8, 2019
@matteovivona matteovivona added this to To do in Version 2.0 via automation Sep 8, 2019
@PhearZero PhearZero mentioned this issue Sep 8, 2019
2 tasks
PhearZero added a commit that referenced this issue Sep 8, 2019
PhearZero added a commit that referenced this issue Sep 9, 2019
PhearZero added a commit that referenced this issue Sep 10, 2019
Basic CodeGen Template #15 #13
PhearZero added a commit that referenced this issue Sep 10, 2019
PhearZero added a commit that referenced this issue Sep 11, 2019
Need a way to smoke test the ecosystem for future work in #17 #15
PhearZero added a commit to HospitalRun/hospitalrun-core that referenced this issue Sep 12, 2019
PhearZero added a commit to HospitalRun/hospitalrun-server that referenced this issue Sep 12, 2019
PhearZero added a commit that referenced this issue Sep 12, 2019
PhearZero added a commit that referenced this issue Sep 12, 2019
@stale
Copy link

stale bot commented Nov 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 12, 2019
@matteovivona matteovivona removed the wontfix This will not be worked on label Nov 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Version 2.0
  
To do
Development

No branches or pull requests

2 participants