Amartus / yang2swagger

Yang to swagger generator
Eclipse Public License 1.0
32 stars 21 forks source link

Add module prefix for Operations. #11

Closed sdj38 closed 6 years ago

sdj38 commented 6 years ago

I noticed that the paths for .../operations/ in the RFC spec require the module name before the operation name. For example instead of /restconf/operations/reset if 'reset' was inside a 'system' module it should look like this /restconf/operations/system:reset

For example, if "module-A" defined a "reset" RPC operation, then
   invoking the operation would be requested as follows:

      POST /restconf/operations/module-A:reset HTTP/1.1

more details can be found here. https://tools.ietf.org/html/rfc8040#section-3.6

bartoszm commented 6 years ago

Actually it is already supported path handle builder have a parameter to include module name for example com.mrv.yangtools.codegen.impl.path.rfc8040.PathHandlerBuilder#useModuleName it is not directly supported from CLI but you can see an example of how to configure path builder from code here: https://github.com/bartoszm/yang2swagger/blob/master/examples/build-standalone/src/main/java/com/mrv/yangtools/example/YamlGenerator.java

bartoszm commented 6 years ago

@sdj38 Do you know how to use build in feature and we can close this pull request? if not please let me know - I will show you how to use it and probably update documentation ;)

sdj38 commented 6 years ago

Thanks for letting me know about the path builder. I will just use that thanks. I will close this PR.

jdillard commented 5 years ago

In case someone comes across this, there is now a -use-namespaces flag (mentioned in the README) that adds the namespace without the need to edit anything, so try that first.