bart-sk / exegesis

Tools for implementing server-side OpenAPI 3.0.0
MIT License
1 stars 2 forks source link

Observable preklopit na Promise cez .toPromise() #10

Closed KrakenTyio closed 6 years ago

KrakenTyio commented 6 years ago

Pokial controller a jeho operationId metoda vrati observable, nech spravy .toPromise() a vrati dalej na spracovanie.

export class GroupsController {

    getGroups(context: ExegesisContext) {
        return Observable<any>;
    }
}

trosku pretazit middleware na sposob

export default function koaRx() {
  return async (ctx: Context, next: () => Promise<any>): Promise<any> => {
    const data = await next();

    if (data instanceof Observable) {
      return data.toPromise();
    }
  }
}

zapis je z https://github.com/mfellner/koa-rx/blob/master/src/index.ts avsak nefunguje s exegesis

KrakenTyio commented 6 years ago

WIP: uz to mam cez exegesis plugin poriesene