Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

renderOptions may not be working #21

Open
naderafshari opened this issue Oct 6, 2021 · 3 comments
Open

renderOptions may not be working #21

naderafshari opened this issue Oct 6, 2021 · 3 comments

Comments

@naderafshari
Copy link

Command used:
ag asyncapi.yaml @lagoni/asyncapi-quicktype-template
-o output --param "quicktypeLanguage=cplusplus"
--param 'renderOptions={"memberNamingStyle":"camelValue"}'
--output ${CMAKE_CURRENT_BINARY_DIR} --force-write

Output from generator:
[ 26%] Invoking generator to generate AsyncAPI C++ files.
Generating files with options {
"parameters": {
"quicktypeLanguage": "cplusplus",
"renderOptions": "{"memberNamingStyle":"camelValue"}"
},
"quicktypeLanguage": "cplusplus",
"fileExtension": "cpp",
"generatorTargetDir": "/work/sgn-skeleton-cpp/_build/api/async",
"targetDir": "",
"renderOptions": {
"memberNamingStyle": "camelValue"
}
}
Rendering schema LinkStateChangeEvent with render options {
"memberNamingStyle": "camelValue"
}

Generated file:
class LinkStateChangeEvent {
public:
LinkStateChangeEvent() = default;
virtual ~LinkStateChangeEvent() = default;

    private:
    std::shared_ptr<std::string> correlation_id;
    std::shared_ptr<Data> data;
    std::shared_ptr<std::string> datacontenttype;
    std::shared_ptr<std::string> dataschema;
    std::shared_ptr<std::string> event_time;
    std::shared_ptr<std::string> id;
    std::shared_ptr<std::string> source;
    std::shared_ptr<std::string> specversion;
    std::shared_ptr<std::string> subject;
    std::shared_ptr<std::string> type;

As you can see member naming is not camel case. For example, eventTime instead of event_time

Is this a generator problem or a quicktype problem?

@jonaslagoni
Copy link
Owner

Hey @naderafshari, as I see it the options look like they are parsed correctly 🧐 There is no interpretations of the options, they are passed as is.

Are you sure the options are correct? I know that QuickType has some options that are not matched one-to-one and no real documentation to figure it out. You might need to look through the source code to make sure.

@jonaslagoni
Copy link
Owner

@jonaslagoni
Copy link
Owner

jonaslagoni commented Oct 6, 2021

I think you are right it is a bug in here, the only way I see it can be fixed is to create our own option matching and creating accurate enum instances...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants