SEBA-716 load core models before service models

Change-Id: I4f47ce7d0637cd34fb82ff1b73a3b407b4d26262
diff --git a/docs/scripts/swagger_docs.py b/docs/scripts/swagger_docs.py
index e403459..7a01bc7 100644
--- a/docs/scripts/swagger_docs.py
+++ b/docs/scripts/swagger_docs.py
@@ -63,7 +63,22 @@
         elif os.path.isfile(item_abs_path) and ".xproto" in item_abs_path:
             files.append(item_abs_path)
 
-    return [f for f in files if "xproto" in f]
+    protos = [f for f in files if "xproto" in f]
+
+    protos = sorted(protos)
+
+    # remove the core xproto...
+    core_proto = None
+    for proto in protos[:]:
+        if "core.xproto" in proto:
+            protos.remove(proto)
+            core_proto = proto
+
+    # ... and put it at the front of the list
+    if core_proto:
+        protos = [core_proto] + protos
+
+    return protos
 
 
 def main():