glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
11.79k stars 1.04k forks source link

License for Generated C++ with "Helper" Code #2485

Open RespiteSage opened 5 months ago

RespiteSage commented 5 months ago

The quicktype documentation seems to indicate that it is an appropriate tool for generating code for commercial purposes, and I recall seeing somewhere that generated code is not considered derivative work (similarly to how the output of a compiler isn't considered derivative of the compiler). However, when generating C++ code with quicktype there are generally helper functions and/or classes generated alongside the "converted" data structures. Here's an example:

inline void CheckConstraint(const std::string& name, const ClassMemberConstraints& c, int64_t value)
{
    if (c.getMinIntValue() != boost::none && value < *c.getMinIntValue())
    {
        throw ValueTooLowException("Value too low for " + name + " (" + std::to_string(value) + "<" +
                                   std::to_string(*c.getMinIntValue()) + ")");
    }

    if (c.getMaxIntValue() != boost::none && value > *c.getMaxIntValue())
    {
        throw ValueTooHighException("Value too high for " + name + " (" + std::to_string(value) + ">" +
                                    std::to_string(*c.getMaxIntValue()) + ")");
    }
}

Crucially, these helper functions do not appear to be dependent on the input data at all, except to determine which subset of the entire helper "suite" is included.

Would you please add clarifying language somewhere to indicate whether these helper functions are considered derivative work of quicktype itself?