Closed vytautas-pranskunas- closed 1 month ago
You can already choose to export only types. Actually the no client option was there too, but I think I broke it in the last release. I'll fix it
In the meantime choose any of the standalone clients and it won't generate anything so you'll end up with types only anyway
Can you specify standalone client please? Wen outputing only types does it outputs api endpoints as strings too?
What's your config looking like?
I have just found this library as substitution fore typescript codegen. So my config is inherited from that. Nothing fancy, standart just client angular (prefear not to have at all). Prefear to have only types, models and API endpoints as strings
On Sat, 21 Sept 2024, 16:10 Lubos, @.***> wrote:
What's your config looking like?
โ Reply to this email directly, view it on GitHub https://github.com/hey-api/openapi-ts/issues/1073#issuecomment-2365202152, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA54ZF3EFZBP74I4V5CI5QTZXV45HAVCNFSM6AAAAABOTSBDVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRVGIYDEMJVGI . You are receiving this because you authored the thread.Message ID: @.***>
You might want to have a look at the full list of options https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/types/config.ts
Using any non-legacy client will do what you're trying to achieve
I will try later tonight. I took a look before at full config befor adding this ticket however i did not see possibility to set client to none or false, and did not see any property like apiEndpointsOnly true or smthng similar. That means that config might be contr-intuitive...
Maybe using any client will do that but like i said it might (did not try yet) generate unnecessary stuff ๐
On Sat, 21 Sept 2024, 18:15 Lubos, @.***> wrote:
You might want to have a look at the full list of options https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/types/config.ts
Using any non-legacy client will do what you're trying to achieve
โ Reply to this email directly, view it on GitHub https://github.com/hey-api/openapi-ts/issues/1073#issuecomment-2365240446, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA54ZFYPNALAPTTAZS6EEN3ZXWLQVAVCNFSM6AAAAABOTSBDVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRVGI2DANBUGY . You are receiving this because you authored the thread.Message ID: @.***>
so, i have tried what you proposed and it is almost what I am looking for my config: export default defineConfig({ client: @./client-axios', input: 'swagger.json', //' https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml ', // ' https://raw.githubusercontent.com/Redocly/museum-openapi-example/main/openapi.yaml ', // '../../packages/openapi-ts/test/spec/v3.json', output: { format: 'prettier', lint: 'eslint', path: './src/app/infrastructure/api', }, client: @./client-fetch', services: false, schemas: false, });
but in output there is no API endpoints just object where endpoints are KEYS, which i cannot see how i can use it with for example this.http.get(ApiEndpoints. ...name...., params: {}) do you know what i mean?
this ir output os types.ge.ts
export type $OpenApiTs = { '/api/test/public-data': { get: { res: { /**
On Sat, 21 Sept 2024 at 18:23, Vytautas Pranskลซnas @.***> wrote:
I will try later tonight. I took a look before at full config befor adding this ticket however i did not see possibility to set client to none or false, and did not see any property like apiEndpointsOnly true or smthng similar. That means that config might be contr-intuitive...
Maybe using any client will do that but like i said it might (did not try yet) generate unnecessary stuff ๐
On Sat, 21 Sept 2024, 18:15 Lubos, @.***> wrote:
You might want to have a look at the full list of options https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/types/config.ts
Using any non-legacy client will do what you're trying to achieve
โ Reply to this email directly, view it on GitHub https://github.com/hey-api/openapi-ts/issues/1073#issuecomment-2365240446, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA54ZFYPNALAPTTAZS6EEN3ZXWLQVAVCNFSM6AAAAABOTSBDVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRVGI2DANBUGY . You are receiving this because you authored the thread.Message ID: @.***>
--
Pagarbiai,
Vytautas Pranskunas
What's the equivalent configuration in openapi-typescript-codegen?
There is no. Thats why i have created this feature request that in order to consume types and write own client and services it is needed to have exported api urls to constant.
It should not be difficult to export all endpoints like:
Export cont urls = { testUrl = 'testUrl', ...... }
On Sun, 22 Sept 2024, 01:28 Lubos, @.***> wrote:
What's the equivalent configuration in openapi-typescript-codegen?
โ Reply to this email directly, view it on GitHub https://github.com/hey-api/openapi-ts/issues/1073#issuecomment-2365359435, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA54ZF5M27JBRL5A4ASXPJTZXX6KJAVCNFSM6AAAAABOTSBDVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRVGM2TSNBTGU . You are receiving this because you authored the thread.Message ID: @.***>
One more question. I have api where POST accepts request body but when generating it generates extra body property. Is there a wa to remove it?
and generated output is this:
export type TokenRequest = {
username?: string | null;
password?: string | null;
};
export type PostAuthSignInData = {
body?: TokenRequest;
};
@ng-state Are you asking if you can flatten the parameters? The answer to that is no, to avoid conflicts and having to re-route each key into the proper slot (body, path, query)
@vytautas-pranskunas- Assuming you're able to run the latest release, you can now do client: false
to skip generating any client code. It will be further improved in the future, this should work for you for now
Thank you
On Tue, 24 Sept 2024, 02:07 Lubos, @.***> wrote:
@vytautas-pranskunas- https://github.com/vytautas-pranskunas- Assuming you're able to run the latest release, you can now do client: false to skip generating any client code. It will be further improved in the future, this should work for you for now
โ Reply to this email directly, view it on GitHub https://github.com/hey-api/openapi-ts/issues/1073#issuecomment-2369813756, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGHHWZIHSDJEOWI6BXMOX4LZYCULXAVCNFSM6AAAAABOTSBDVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZHAYTGNZVGY . You are receiving this because you were mentioned.Message ID: @.***>
Description
It would be good when there is an option to output only types, models, enums, etc but no client and no services. Then people would not be limited to clients package provides but they could write own clients without having unused client in code base