Skip to content

[Feature] Support more languages #2

@Kaoticz

Description

@Kaoticz

Json2Sharp currently supports 2 languages, C# and Python. I'd like to add support to more languages, but I lack the time to do so.
The project is structured in a way that allows new languages to be easily implemented. If you're interested in contributing, here is how you can do so:

  • Fork this repository, clone it into your machine, and create a new branch.
  • Notice there are 3 .NET projects:
    • Json2SharpApp: This is the CLI application, that you run in the terminal.
    • Json2SharpLib: This is the library that is published to NuGet, where all the parsing logic is located.
    • Json2SharpTests: These are unit tests that ensure the code behaves how it is supposed to.
  • In the library project, create a class that inherits from CodeEmitter (the actual requirement is the ICodeEmitter interface, but CodeEmitter has some methods that could prove useful to you).
  • Provide an implementation for the abstract methods. Feel free to look at the existing CodeEmitters for inspiration.
  • Head to the GetLanguageEmitter method in the Json2Sharp class and add your emitter there. Don't forget to add the appropriate options to Json2SharpOptions.
  • Go to Json2SharpTests and create unit tests for the emitter you made. Feel free to look at the existing tests for inspiration.
  • Once you got your code emission to work as intended, head to ConfigHandler and implement the options your emitters are supposed to handle.
  • Create a pull request and wait for the code review. If adjustments are suggested, then go and implement them. Once everything is ok, your changes will be accepted and merged with main 🎉

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions