Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Create a Lexicon Generator #31

Open
MasterJ93 opened this issue Jul 26, 2024 · 1 comment
Open

[Feature Request]: Create a Lexicon Generator #31

MasterJ93 opened this issue Jul 26, 2024 · 1 comment
Assignees
Labels
draft This issue is simply a draft and should not be considered until it's complete new feature New feature or request

Comments

@MasterJ93
Copy link
Owner

Summary

Create a solution for not only creating lexicons, but also converting them into Swift models and methods.

Pain points

At this time, all lexicon models and methods need to be written by hand. This can cause issues with missing out features, duplicating code, making mistakes, and sloppy implementations. Creating a lexicon generator would solve all of these problems.

The idea is to create an app and CLI tool that will do the following:

  • Create and validate the lexicon in a JSON format.
  • Take all of the AT Protocol-provided and Bluesky-provided lexicons and convert them into validated Swift models and methods.
  • Give proper syntax and clean code for each model and method, which would also conform to the ATProtoKit API Design Guidelines and the Swift API Design Guidelines.

There will be some limitations:

  • Some lexicons in Bluesky and AT Protocol are built into some places and will be treated differently. For example, all of the lexicons related to creating and managing sessions must be in ATProtocolConfiguration, and com.atproto.repo.uploadBlob is required to be in APIClientService.
  • The first version may not implement any lexicons that have the subscription value, due to their special nature and still-highly-moldable structure of the models and methods.

The app and CLI tool will simply allow you to insert the lexicon JSON files, as well as an optional configuration file of adding extra information (such as comments). The app will specifically show common errors among any JSON errors when creating or viewing a lexicon file (not available in version 1.0).

Considered Alternatives

N/A

Is this a breaking change?

No

Library Examples

The repo swift-atproto has a good understanding of what could be done in terms of the lexicon generator. However, using it as-is isn't ideal: a better one would need to be made that better fits with the design goals of ATProtoKit.

Additional Context

This will most likely be in another repository, so progress will be followed over there instead of here. When it's completed its goals, this issue will close.

@MasterJ93 MasterJ93 added new feature New feature or request draft This issue is simply a draft and should not be considered until it's complete labels Jul 26, 2024
@MasterJ93 MasterJ93 self-assigned this Jul 26, 2024
@MasterJ93 MasterJ93 pinned this issue Oct 25, 2024
@MasterJ93 MasterJ93 unpinned this issue Nov 7, 2024
@MasterJ93
Copy link
Owner Author

It appears that OpenAPI Generator from Apple may be the most likely candidate for this. Will have to research further...

@MasterJ93 MasterJ93 pinned this issue Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft This issue is simply a draft and should not be considered until it's complete new feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant