We have a Drupal installation that acts as a backend and a front end that uses the HttpClientModule from Angular to query this data.

Thanks to the typescript base, we can provide the functions of this service with the expected return type like this.httpClient.get<ExpectedTypeInterface>(urlToJsonResource). The important question is: Where does the implementation of the ExpectedTypeInterface come from?

Wehn I inspect our API via OpenAPI/Swagger UI, I see that there is schema information available. Is there a standard way of exporting this information into typescript interfaces?

Creating them by hand would be a bad choice, because than the front end might get outdated type definitions.

1 Answer 1


OpenAPI offers an endpoint under /openapi/rest?_format=json that delivers the complete json schema. For the transformation, we need the node package json-schema-to-typescript. This package offers a cli that lets us transform the json schema into a typescript file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.