contiamo / restful-react

A consistent, declarative way of interacting with RESTful backends, featuring code-generation from Swagger and OpenAPI specs 🔥
MIT License
1.87k stars 109 forks source link

feat: sort interfaces by name #360

Closed vkbansal closed 3 years ago

vkbansal commented 3 years ago

Why

solves #359

netlify[bot] commented 3 years ago

:construction_worker: Deploy request for restful-react accepted.

:hammer: Explore the source changes: 357c2242f7bb828336dd6329f3e1080c5de04444

:mag: Inspect the deploy log: https://app.netlify.com/sites/restful-react/deploys/60b77a37e82b8d0007106800

vkbansal commented 3 years ago

@fabien0102 This is how it will work.

Also I would like to do the same here https://github.com/contiamo/restful-react/blob/master/src/scripts/import-open-api.ts#L151

Can you suggest a way to do it?

fabien0102 commented 3 years ago

@fabien0102 This is how it will work.

Also I would like to do the same here https://github.com/contiamo/restful-react/blob/master/src/scripts/import-open-api.ts#L151

Can you suggest a way to do it?

This is indeed quite deep, will be a pain to add an option here… 😕 Otherwise, another approch will be to add a postprocess step, taking the generated file as input, and reordering using typescript compiler directly (https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#re-printing-sections-of-a-typescript-file)

fabien0102 commented 3 years ago

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md

Or, you can maybe use an eslint rule (with --fix) on this file

vkbansal commented 3 years ago

I guess I can also use transform options to pre-process the json using fast-json-stable-stringify

fabien0102 commented 3 years ago

I guess I can also use transform options to pre-process the json using fast-json-stable-stringify

Indeed! Smart idea!