Package com.wordnik.swagger.model

Examples of com.wordnik.swagger.model.ApiListing


                    listingPath = "/" + listingPath;
                return path.equals(listingPath);
            }
        });

        ApiListing listing = getFirst(listings, null);

        if (listing == null) {
            throw new ResourceNotFoundException();
        }
        return listing;
View Full Code Here


  private ResponseEntity<ApiListing> getSwaggerApiListing(String swaggerGroup, String apiDeclaration) {
    ResponseEntity<ApiListing> responseEntity = new ResponseEntity<ApiListing>(HttpStatus.NOT_FOUND);
    Map<String, ApiListing> apiListingMap = swaggerCache.getSwaggerApiListingMap().get(swaggerGroup);
    if (null != apiListingMap) {
      ApiListing apiListing = apiListingMap.get(apiDeclaration);
      if (null != apiListing) {
        responseEntity = new ResponseEntity<ApiListing>(apiListing, HttpStatus.OK);
      }
    }
    return responseEntity;
View Full Code Here

        ArrayList sortedDescriptions = new ArrayList(apiDescriptions);
        Collections.sort(sortedDescriptions, this.apiDescriptionOrdering);

        String resourcePath = longestCommonPath(sortedDescriptions);

        ApiListing apiListing = new ApiListing(
                apiVersion,
                swaggerVersion,
                swaggerPathProvider.getApplicationBasePath(),
                resourcePath,
                toScalaList(produces),
View Full Code Here

        SwaggerConfig config = new SwaggerConfig();
        config.setBasePath("http://localhost:8080/api");
        RestSwaggerReader reader = new RestSwaggerReader();
        Option<ApiListing> option = reader.read(rest, config);
        assertNotNull(option);
        ApiListing listing = option.get();
        assertNotNull(listing);

        String json = JsonSerializer.asJson(listing);
        log.info(json);
View Full Code Here

        servletRequest.setAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, "/api/doc/api/v1/test");
        ApiDocumentationController apiDocumentationController = new ApiDocumentationController();
        apiDocumentationController.setApiVersion("v1");
        apiDocumentationController.setBaseControllerPackage(BASE_CONTROLLER_PACKAGE);
        apiDocumentationController.setBasePath("http://localhost/swagger4spring-web-example");
        ApiListing documentation = apiDocumentationController.getDocumentation(servletRequest);
        assertNotNull(documentation);
        assertEquals(documentation.apiVersion(), "v1");
        assertEquals(documentation.resourcePath(), "/api/v1/test");
    }
View Full Code Here

    @Test
    public void testParseControllerDocumentation() {
        Map<String, ApiListing> documentList = createApiParser().createApiListings();
        for (String key : documentList.keySet()) {
            ApiListing documentation = documentList.get(key);
            ScalaObjectMapper mapper = new ScalaObjectMapper();
            try {
                String documentationAsJSON = mapper.writeValueAsString(documentation);
                System.out.println(documentationAsJSON);
                ApiListing documentationDeserialized = JsonSerializer.asApiListing(documentationAsJSON);
                assertNotNull(documentationDeserialized);
                assertTrue(documentationDeserialized.swaggerVersion().equals(SwaggerSpec.version()));
                assertTrue(documentationDeserialized.apiVersion().equals("v1"));
                assertTrue(documentationDeserialized.basePath().equals("http://localhost:8080/api"));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
View Full Code Here

    // will append api's basePath. However, apiReader does not read it
    // correctly by now
    if (doc.basePath() != null) {
      this.basePath = doc.basePath();
    }
    ApiListing newDoc = new ApiListing(doc.apiVersion(),
        doc.swaggerVersion(), this.basePath, doc.resourcePath(),
        doc.produces(), doc.consumes(), doc.protocols(),
        doc.authorizations(), doc.apis(), doc.models(),
        doc.description(), doc.position());
    validDocuments.add(newDoc);
View Full Code Here

        HashMap<String, Model> _models = new HashMap<String, Model>();
        for (String key: doc.getModels().keySet()) {
            _models.put(key, doc.getModels().get(key).toSwaggerModel());
        }

        return new ApiListing(doc.getApiVersion(), doc.getSwaggerVersion(), doc.getBasePath(), doc.getResourcePath(),
                Utils.toScalaImmutableList(doc.getProduces()), Utils.toScalaImmutableList(doc.getConsumes()),
                Utils.toScalaImmutableList(doc.getProtocols()),
                new ListConverter<JAuthorization, Authorization>(doc.getAuthorizations()).convert(),
                new ListConverter<JApiDescription, ApiDescription>(doc.getApis()).convert(),
                Option.apply(Utils.toScalaImmutableMap(_models)), Option.apply(doc.getDescription()), doc.getPosition());
View Full Code Here

TOP

Related Classes of com.wordnik.swagger.model.ApiListing

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.