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 basemodel | 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(){
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.
π 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
canextend | override
from thebase
model | service
in order to preform module requirements.Possible Generators:
OpenAPI Isomorphic Models
Fastify Decorators and Routes
// All route based services look similar to: import {User} from '@hospitalrun-org/core' fastify.post('/users', (request,reply)=> {reply.send( fastify.operationId(instanceof User))} )
// Example component import {UserService, User} from '@hospitalrun-org/core' import * as React from 'react' export default class UserPage extends React.Component { render(){