Splitting API definitions in multiple folders

Copied from Github discussion

:wave: friends,

Our API definitions started growing a lot which made them difficult to worked with. We have a single api-definitions folder with every definition under it. Ideally, we would like to split them by domain/micro-service. For instance

πŸ“ api-definitions
  πŸ“ users
  πŸ“ attachments

It is not obvious from the documentation or code whether this is possible but when following the way API definitions are loaded, I saw that Glob is used. Which means, setting an app_path to api-definitions/** would actually glob the nested folders.

I’ve tried the above and it actually worked! So my question is, is this an unintentional side-effect or an undocumented functionality? Would be it be safe to use it as such?

1 Like

This is awesome. I definitely didn’t know about this. Good find :+1:

I see it was added in v2.7 to read the entire directory for JS plugins. I am not sure about why it was added for APIs but it is really cool.

I have asked internally about the context and your concerns. However, I don’t think there are any issues.

Will update you as soon as possible

I was so excited I forgot. Big welcome to the community :heart:

1 Like

Feedback as of now is there are no issues. We will definitely add this to our docs as a way of organizing APIs.

In addition, we would like to send you a public thanks for spotting this and giving back to the community :metal:.

Kindly DM your details and address so we can send you some well-deserved Tyk :tyk2: swag

1 Like