mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	openapi: Use at most one inline subschema in allOf.
This fixes some of the warnings from openapi-generator. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		@@ -10,6 +10,17 @@ const SwaggerParser = require("swagger-parser");
 | 
			
		||||
function checkRefSiblings(file, path, data) {
 | 
			
		||||
    let ok = true;
 | 
			
		||||
    if (typeof data === "object" && data !== null) {
 | 
			
		||||
        if (
 | 
			
		||||
            "allOf" in data &&
 | 
			
		||||
            Object.values(data.allOf).filter((subschema) => !("$ref" in subschema)).length !== 1
 | 
			
		||||
        ) {
 | 
			
		||||
            console.error(
 | 
			
		||||
                `${file}: Too many inline allOf subschemas at ${JSON.stringify(
 | 
			
		||||
                    path,
 | 
			
		||||
                )}: ${JSON.stringify(data, undefined, 2)}`,
 | 
			
		||||
            );
 | 
			
		||||
            ok = false;
 | 
			
		||||
        }
 | 
			
		||||
        if ("$ref" in data && Object.entries(data).length !== 1) {
 | 
			
		||||
            console.error(
 | 
			
		||||
                `${file}: Siblings of $ref have no effect at ${JSON.stringify(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user