001// Licensed to the Apache Software Foundation (ASF) under one
002// or more contributor license agreements.  See the NOTICE file
003// distributed with this work for additional information
004// regarding copyright ownership.  The ASF licenses this file
005// to you under the Apache License, Version 2.0 (the
006// "License"); you may not use this file except in compliance
007// with the License.  You may obtain a copy of the License at
008//
009// http://www.apache.org/licenses/LICENSE-2.0
010//
011// Unless required by applicable law or agreed to in writing,
012// software distributed under the License is distributed on an
013// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
014// KIND, either express or implied.  See the License for the
015// specific language governing permissions and limitations
016// under the License.
017
018package org.apache.tapestry5.services.rest;
019
020import org.apache.tapestry5.internal.services.rest.DefaultOpenApiDescriptionGenerator;
021import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration;
022import org.apache.tapestry5.json.JSONObject;
023
024/**
025 * Service used to generate OpenAPI 3.0 description in JSON format for an application 
026 * REST endpoints (i.e. REST endpoint event handler methods). A base implementation, 
027 * {@linkplain DefaultOpenApiDescriptionGenerator}, is automatically added as the first
028 * contribution to the service's distributed configuration. Other implementations of this 
029 * interface can be contributed to further customize the description.
030 */
031@UsesOrderedConfiguration(OpenApiDescriptionGenerator.class)
032public interface OpenApiDescriptionGenerator
033{
034    /**
035     * Generates or customizes the OpenAPI 3.0 documentation for this webapp's REST endpoints.
036     * 
037     * @param documentation a {@link JSONObject} object.
038     * @return the generated or customized OpenAPI 3.0 documentation as a JSON object.
039     */
040    JSONObject generate(JSONObject documentation);
041}