Open harsszegi opened 6 years ago
I see. To me the first point is much more problematic, since that's quicktype's default mode of operation.
As to the testing: unfortunately our test suite doesn't currently test multiple top-levels, or it would have caught those issues. I guess that's my responsibility.
PS: If you do fix those, please make a PR for one of them first, and only when we've merged that, for the other one ;-)
I believe that I'm running into this same issue. I only have one single-source generated file in my project, but I'm getting "mulitple definition" linking errors on the two void CheckConstraint(...)
methods. Making them inline seems to fix the problem (similar to the inline json get_untyped(...)
methods).
Would changing "void" to "inline void" on lines 1771 and 1828 of the below file fix the issue? If so, I'm happy to attempt a pull request.
Hello Mark, just realized a few things:
if single-source is generated and multiple (more than one) generated JSON structures are used in the application, compilation will fail, as - because of the single source generation logic - the same common (""helper"") functions will be defined multiple times in the same namespace.
if multi-source is generated and multiple (more than one) generated JSON structures are used, the application will not compile. the background reason is that the testing framework expects one single file (Toplevel.hpp + Generators.hpp) so currently the C++ lang generates Generators.hpp for every requests (e.g. instead of Foo_generator.hpp, Pokedex_generator.hpp, etc.) Obviously I can fix that, just that have zero idea how to fix that in the testing framework.