nebius/SWE-bench-extra huggingface dataset:
Repository: linkml/linkml

Issue:
gen-json-schema should warn or error if --top-class option does not correspond to class in schema
If I run `gen-json-schema` with and the value I provide for the `--top-class` does _not_ correspond to a class in the schema, I have made an obvious mistake that `gen-json-schema` can easily detect. I think it should either warn or error out in this situation. 

Comments:

Patch:
diff --git a/linkml/generators/jsonschemagen.py b/linkml/generators/jsonschemagen.py
index c287696a..aa8dbc5d 100644
--- a/linkml/generators/jsonschemagen.py
+++ b/linkml/generators/jsonschemagen.py
@@ -181,6 +181,10 @@ class JsonSchemaGenerator(Generator):
 
         super().__post_init__()
 
+        if self.top_class:
+            if self.schemaview.get_class(self.top_class) is None:
+                logging.warning(f"No class in schema named {self.top_class}")
+
     def start_schema(self, inline: bool = False) -> JsonSchema:
         self.inline = inline
 


Test patch:
diff --git a/tests/test_generators/test_jsonschemagen.py b/tests/test_generators/test_jsonschemagen.py
index 6044035c..d7a7ff43 100644
--- a/tests/test_generators/test_jsonschemagen.py
+++ b/tests/test_generators/test_jsonschemagen.py
@@ -246,6 +246,11 @@ def test_empty_inlined_as_dict_objects(subtests, input_path):
     external_file_test(subtests, input_path("jsonschema_empty_inlined_as_dict_objects.yaml"))
 
 
+def test_missing_top_class(input_path, caplog):
+    JsonSchemaGenerator(input_path("kitchen_sink.yaml"), top_class="NotARealClass")
+    assert "No class in schema named NotARealClass" in caplog.text
+
+
 # **********************************************************
 #
 #    Utility functions