Skip to content

alternative generator for ts and flow#28

Open
KriNeko wants to merge 6 commits intosergeysova:masterfrom
KriNeko:master
Open

alternative generator for ts and flow#28
KriNeko wants to merge 6 commits intosergeysova:masterfrom
KriNeko:master

Conversation

@KriNeko
Copy link
Copy Markdown

@KriNeko KriNeko commented Aug 31, 2019

Parser and code generator(ts, flow)

@valscion
Copy link
Copy Markdown
Collaborator

valscion commented Sep 2, 2019

Cool! So this parser is able to figure out everything from the API documentation without having to hard-code any type information like the previous version does here, right?

function addBuiltins(store) {
store.add(new Interface('CallbackGame', {
description: 'A placeholder, currently holds no information. Use BotFather to set up your game.',
}))
store.add(new Interface('InputFile', {
description: 'This object represents the contents of a file to be uploaded. '
+ 'Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.',
}))
store.add(new Interface(
'PassportData', {
description: 'Contains information about Telegram Passport data shared with the bot by the user.',
},
{
data: new Field('data', 'Array of EncryptedPassportElement'),
credentials: new Field('credentials', 'EncryptedCredentials'),
}
))
store.add(new Interface('EncryptedPassportElement', {
desciption: 'Contains information about documents or other Telegram Passport elements shared with the bot by the user.',
}))
store.add(new Interface('EncryptedCredentials', {
description: 'Contains data required for decrypting and authenticating EncryptedPassportElement.'
+ ' See the Telegram Passport Documentation for a complete description of the data decryption'
+ ' and authentication processes.',
}))
// TODO: remove after parse UNIONS
store.add(new Union('InputMessageContent', {
description: 'This object represents the content of a message to be sent as a result of an inline query.',
}, [
'InputTextMessageContent',
'InputLocationMessageContent',
'InputVenueMessageContent',
'InputContactMessageContent',
]))
store.add(new Union('InputMedia', {
description: 'This object represents the content of a media message to be sent.',
}, [
'InputMediaPhoto',
'InputMediaVideo',
]))
store.add(new Union('InlineQueryResult', {
description: 'This object represents one result of an inline query',
}, [
'InlineQueryResultCachedAudio',
'InlineQueryResultCachedDocument',
'InlineQueryResultCachedGif',
'InlineQueryResultCachedMpeg4Gif',
'InlineQueryResultCachedPhoto',
'InlineQueryResultCachedSticker',
'InlineQueryResultCachedVideo',
'InlineQueryResultCachedVoice',
'InlineQueryResultArticle',
'InlineQueryResultAudio',
'InlineQueryResultContact',
'InlineQueryResultGame',
'InlineQueryResultDocument',
'InlineQueryResultGif',
'InlineQueryResultLocation',
'InlineQueryResultMpeg4Gif',
'InlineQueryResultPhoto',
'InlineQueryResultVenue',
'InlineQueryResultVideo',
'InlineQueryResultVoice',
]))
}


In order for me to be able to review this, we'd need to get the diff of the generated files to a reasonable amount. What if we'd first do a PR to run all the generated, current files through prettier, merge that PR, and then update this PR to also do a post-process pass through prettier?

I hope we would get to a few hundred lines of changes to the generated type files instead of thousands.

@sergeysova
Copy link
Copy Markdown
Owner

What about generator for rust language?

@EdJoPaTo
Copy link
Copy Markdown

Any progress on this? @KriNeko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants