libyang MAINTENANCE header file dependencies
diff --git a/src/common.c b/src/common.c
index 883f3f4..fa27588 100644
--- a/src/common.c
+++ b/src/common.c
@@ -30,6 +30,7 @@
 
 #include "compat.h"
 #include "tree_schema_internal.h"
+#include "xml.h"
 
 void *
 ly_realloc(void *ptr, size_t size)
diff --git a/src/context.h b/src/context.h
index 029f513..34fd927 100644
--- a/src/context.h
+++ b/src/context.h
@@ -25,9 +25,7 @@
 extern "C" {
 #endif
 
-struct lyd_node;
 struct lys_module;
-struct lysc_node;
 
 /**
  * @page howtoContext Context
diff --git a/src/in_internal.h b/src/in_internal.h
index 35e90fc..5ee320c 100644
--- a/src/in_internal.h
+++ b/src/in_internal.h
@@ -16,7 +16,6 @@
 #define LY_IN_INTERNAL_H_
 
 #include "in.h"
-#include "tree_schema_internal.h"
 
 /**
  * @brief Parser input structure specifying where the data are read.
diff --git a/src/json.c b/src/json.c
index fcb467f..1c30ac5 100644
--- a/src/json.c
+++ b/src/json.c
@@ -22,6 +22,7 @@
 #include "common.h"
 #include "in_internal.h"
 #include "json.h"
+#include "tree_schema_internal.h"
 
 #define JSON_PUSH_STATUS_RET(CTX, STATUS) \
     LY_CHECK_RET(ly_set_add(&CTX->status, (void*)STATUS, 1, NULL))
diff --git a/src/lyb.h b/src/lyb.h
index 27ba14f..5c9077d 100644
--- a/src/lyb.h
+++ b/src/lyb.h
@@ -19,12 +19,8 @@
 #include <stdint.h>
 
 #include "parser_internal.h"
-#include "set.h"
-#include "tree.h"
 
-struct hash_table;
 struct ly_ctx;
-struct lyd_node;
 struct lysc_node;
 
 /**
diff --git a/src/out_internal.h b/src/out_internal.h
index e157734..14f74cf 100644
--- a/src/out_internal.h
+++ b/src/out_internal.h
@@ -16,8 +16,8 @@
 #define LY_OUT_INTERNAL_H_
 
 #include "out.h"
-#include "printer_data.h"
-#include "printer_schema.h"
+
+struct lyd_node;
 
 /**
  * @brief Printer output structure specifying where the data are printed.
diff --git a/src/parser_internal.h b/src/parser_internal.h
index b81a6ff..dba6078 100644
--- a/src/parser_internal.h
+++ b/src/parser_internal.h
@@ -16,11 +16,13 @@
 #define LY_PARSER_INTERNAL_H_
 
 #include "parser_data.h"
-#include "plugins_types.h"
-#include "tree_schema_internal.h"
+#include "set.h"
 
 struct lyd_ctx;
 struct ly_in;
+struct lys_yang_parser_ctx;
+struct lys_yin_parser_ctx;
+struct lys_parser_ctx;
 
 /**
  * @brief Callback for ::lyd_ctx to free the structure
diff --git a/src/path.h b/src/path.h
index b98f366..63c9b07 100644
--- a/src/path.h
+++ b/src/path.h
@@ -23,7 +23,6 @@
 #include "tree_data.h"
 
 struct ly_ctx;
-struct lys_glob_unres;
 struct lys_module;
 struct lysc_ext_instance;
 struct lysc_node;
diff --git a/src/plugins_exts.h b/src/plugins_exts.h
index 3a53e9f..97e0893 100644
--- a/src/plugins_exts.h
+++ b/src/plugins_exts.h
@@ -25,11 +25,8 @@
 
 struct ly_ctx;
 struct lyd_node;
-struct lysc_ctx;
-struct lysc_ext_instance;
 struct lysc_ext_substmt;
 struct lysp_ext_instance;
-struct lyspr_ctx;
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/src/plugins_exts_compile.h b/src/plugins_exts_compile.h
index b8843df..3a0d148 100644
--- a/src/plugins_exts_compile.h
+++ b/src/plugins_exts_compile.h
@@ -21,7 +21,6 @@
 #include "tree_schema.h"
 
 struct ly_ctx;
-struct lyd_node;
 struct lysc_ctx;
 
 #ifdef __cplusplus
diff --git a/src/plugins_internal.h b/src/plugins_internal.h
index 86da39d..2a95e86 100644
--- a/src/plugins_internal.h
+++ b/src/plugins_internal.h
@@ -19,7 +19,7 @@
 
 #include "plugins.h"
 #include "plugins_exts.h"
-#include "tree_schema.h"
+#include "plugins_types.h"
 
 #define LY_TYPE_UNKNOWN_STR "unknown"               /**< text representation of ::LY_TYPE_UNKNOWN */
 #define LY_TYPE_BINARY_STR "binary"                 /**< text representation of ::LY_TYPE_BINARY */
diff --git a/src/printer_tree.c b/src/printer_tree.c
index a49b84c..c0a1a11 100644
--- a/src/printer_tree.c
+++ b/src/printer_tree.c
@@ -93,6 +93,7 @@
 #include "common.h"
 #include "compat.h"
 #include "out_internal.h"
+#include "printer_schema.h"
 #include "tree_schema_internal.h"
 #include "xpath.h"
 
diff --git a/src/schema_compile.h b/src/schema_compile.h
index 1df79e1..9c2e615 100644
--- a/src/schema_compile.h
+++ b/src/schema_compile.h
@@ -19,11 +19,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "dict.h"
 #include "log.h"
 #include "set.h"
 #include "tree.h"
-#include "tree_edit.h"
 #include "tree_schema.h"
 
 struct lyxp_expr;
diff --git a/src/tree_data_internal.h b/src/tree_data_internal.h
index bc3eb82..a41a6fb 100644
--- a/src/tree_data_internal.h
+++ b/src/tree_data_internal.h
@@ -17,7 +17,6 @@
 
 #include "log.h"
 #include "plugins_types.h"
-#include "set.h"
 #include "tree_data.h"
 
 #include <stddef.h>
diff --git a/src/tree_edit.h b/src/tree_edit.h
index 7284b4f..358711b 100644
--- a/src/tree_edit.h
+++ b/src/tree_edit.h
@@ -18,9 +18,6 @@
 
 #include <stdlib.h>
 
-#include "log.h"
-#include "tree.h"
-
 #ifndef LOGMEM
 #define LOGMEM(CTX)
 #endif
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index fab6f2b..f7f7be0 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -20,7 +20,6 @@
 #include "common.h"
 #include "set.h"
 #include "tree_schema.h"
-#include "xml.h"
 
 struct lysc_ctx;
 struct lys_glob_unres;