graphiti-api / graphiti-rails

MIT License
54 stars 28 forks source link

Generated file namespacing incorrect after updating namespace #36

Open th-ad opened 5 years ago

th-ad commented 5 years ago

Issue After updating the namespace key in the .graphiticfg.yml file and generating a resource, the old API namespacing is still applied to the generated files.

Expected Behavior If I were to change the namespacing from /api/v1 to /api/v2 in .graphiticfg.yml, I would expect all of my newly generated files to be prefixed by /api/v2, not /api/v1

Solution The API namespace is set upon initial use of the generator. If the install generator is not used, the ApplicationResource class will be created by the first use of the resource generator. After that, files will be created with the namespacing based on the endpoint_namespace attribute in the ApplicationResource class.

If .graphiticfg.yml is the source of truth, it seems like the ApplicationResource class should be updated when the namespace is changed.

Let me know if you want help, I'm willing to throw up a quick fix for this!