मेरे पास एक पुरानी एपीआई है जिसे मैंने हाल ही में बनाया है और मुझे याद नहीं होगा कि इसे कुछ महीनों में कैसे उपयोग किया जाए। मैंने स्वैगर का उपयोग करके अपने एपीआई को दस्तावेज करने का फैसला किया, हालांकि मैं पागल हो रहा हूं।स्वैगर यूआई 2.1 अटक "संसाधन सूची लाने"
मैंने वाईएएमएल फ़ाइल बनाने के लिए http://editor.swagger.io/ का उपयोग किया जो मैं फिर एक JSON फ़ाइल में परिवर्तित करता हूं Swagger का उपयोग कर सकते हैं। जब मैं स्वैगर यूआई में फाइल डालता हूं तो यह fetching resource list: localhost/swagger.json
पर अटक जाता है और कंसोल Uncaught TypeError: Cannot read property '$ref' of undefined
कहता है।
मैं संस्करण स्वैगर यूआई के 2.1.0-alpha.5 उपयोग कर रहा हूँ।
यहाँ मेरी कल्पना फ़ाइल है:
swagger: '2.0' info: title: TITLE description: BLAH, BLAH, BLAH, ETC version: "1.0b" host: api.example.com schemes: - http basePath: /v1 produces: - application/json paths: /match.json: get: #summary: Match Data description: Used for getting data about a match parameters: - name: id in: query description: The match ID of from a game required: true type: integer format: int32 - name: key in: query description: API key used for authentication. required: true type: string responses: 200: description: Returns match data schema: type: array items: $ref: '#/definitions/MatchData' default: description: Unexpected error schema: $ref: '#/definitions/Error' definitions: MatchData: properties: info: type: integer format: int64 description: General information about the match time: type: integer format: int64 description: Information about the start/end time stats: type: array format: int64 description: Stats about the match Error: required: - errorID - message properties: errorID: type: string description: Error ID. message: type: string description: Information about the error.
आप swagger.json कैसे होस्ट कर रहे हैं तुम कैसे अकड़-ui चला सकता हूँ – Ron
@webron काम करता है: "swagger.json" फ़ाइल जड़ में है मेरे htdocs निर्देशिका का। और रेपो से "dist" निर्देशिका रूट पर भी है लेकिन इसका नाम बदला गया है। मैं इसे होस्ट करने के लिए xampp का उपयोग कर रहा हूं। – kevc45