org.raml.model.Action.getBody()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.raml.model.Action.getBody()方法的一些代码示例,展示了Action.getBody()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action.getBody()方法的具体详情如下:
包路径:org.raml.model.Action
类名称:Action
方法名:getBody

Action.getBody介绍

暂无

代码示例

代码示例来源:origin: com.sap.cloud.yaas.service-generator/service-generator-model-raml

private Collection<String> toConsumes(final String globalMediaType, final Action source)
{
  if (source.getBody() == null || source.getBody().isEmpty())
  {
    return Collections.singletonList(globalMediaType);
  }
  else
  {
    return source.getBody().keySet();
  }
}

代码示例来源:origin: guru.nidi.raml/raml-doc-client

private void loadSchemas(Action action) {
  if (action.getBody() != null) {
    for (final MimeType mime : action.getBody().values()) {
      loadSchema(mime);
    }
  }
  for (final Response response : action.getResponses().values()) {
    loadSchemas(response);
  }
}

代码示例来源:origin: mulesoft-labs/raml-jaxrs-codegen

private void addResourceMethods(final Resource resource,
                final JDefinedClass resourceInterface,
                final String resourceInterfacePath) throws Exception
{
  for (final Action action : resource.getActions().values())
  {
    if (!action.hasBody())
    {
      addResourceMethods(resourceInterface, resourceInterfacePath, action, null, false);
    }
    else if (action.getBody().size() == 1)
    {
      final MimeType bodyMimeType = action.getBody().values().iterator().next();
      addResourceMethods(resourceInterface, resourceInterfacePath, action, bodyMimeType, false);
    }
    else
    {
      for (final MimeType bodyMimeType : action.getBody().values())
      {
        addResourceMethods(resourceInterface, resourceInterfacePath, action, bodyMimeType, true);
      }
    }
  }
  for (final Resource childResource : resource.getResources().values())
  {
    addResourceMethods(childResource, resourceInterface, resourceInterfacePath);
  }
}

代码示例来源:origin: ru.lanwen.raml/rarc-core

@Override
  public void apply(Action action, ResourceClassBuilder resourceClassBuilder) {
    LOG.info("Process action {}", action);

    resourceClassBuilder.getApiClass().withMethod(
        new ActionMethod(resourceClassBuilder.getReq(),
            resourceClassBuilder.getResp(),
            resourceClassBuilder.getUri(),
            action));

    action.getQueryParameters().forEach(resourceClassBuilder.applyParamRule);
    action.getHeaders().forEach(resourceClassBuilder.applyParamRule);
    if (action.getBody() != null) {
      action.getBody().values().forEach(resourceClassBuilder.applyBodyRule);
    }
    action.getResponses().values().forEach(resourceClassBuilder.applyResponseRule);
  }
}

代码示例来源:origin: org.raml/raml-jaxrs-codegen-core

addResourceMethods(resourceInterface, resource, resourceInterfacePath,
      action, null, false);
} else if (action.getBody().size() == 1) {
  final MimeType bodyMimeType = action.getBody().values()
      .iterator().next();
  addResourceMethods(resourceInterface, resource, resourceInterfacePath,
      action, bodyMimeType, false);
} else {
  for (final MimeType bodyMimeType : action.getBody().values()) {
    addResourceMethods(resourceInterface, resource,
        resourceInterfacePath, action, bodyMimeType, true);

代码示例来源:origin: com.sap.cloud.yaas.service-generator/service-generator-model-raml

private Map<String, String> adjustInlineSchema(final Resource singleResource) throws IOException
{
  final ImmutableMap.Builder<String, String> inlinedSchemas = ImmutableMap.builder();
  for (final Map.Entry<ActionType, Action> actionEntry : singleResource.getActions().entrySet())
  {
    for (final Map.Entry<String, Response> responseEntry : actionEntry.getValue().getResponses().entrySet())
    {
      if (!TransformUtils.isErrorResponse(responseEntry.getKey()))
      {
        final Response response = responseEntry.getValue();
        final String schemaName = JSONSchemaNameUtil
            .getSchemaName(singleResource, actionEntry.getKey(), responseEntry.getKey());
        inlinedSchemas.putAll(createSchemas(schemaName, response.getBody()));
      }
    }
    final Action action = actionEntry.getValue();
    final String schemaName = JSONSchemaNameUtil.getSchemaName(singleResource, actionEntry.getKey());
    inlinedSchemas.putAll(createSchemas(schemaName, action.getBody()));
  }
  for (final Resource subResource : singleResource.getResources().values())
  {
    inlinedSchemas.putAll(adjustInlineSchema(subResource));
  }
  return inlinedSchemas.build();
}

代码示例来源:origin: com.sap.cloud.yaas.raml-parser/raml-parser

for (Action action : actionMap.values())
  if (action.getBody() != null && action.getBody().isEmpty())
    action.getBody().put(mediaType, new MimeType(mediaType));

代码示例来源:origin: org.raml/raml-parser

for (Action action : actionMap.values())
  if (action.getBody() != null && action.getBody().isEmpty())
    action.getBody().put(mediaType, new MimeType(mediaType));

代码示例来源:origin: nidi3/raml-tester

private static void createTotalUsage(Usage usage, Map<String, Resource> resources) {
    for (final Map.Entry<String, Resource> resourceEntry : resources.entrySet()) {
      resourceUsage(usage, resourceEntry.getValue());
      for (final Action action : resourceEntry.getValue().getActions().values()) {
        actionUsage(usage, action).initQueryParameters(action.getQueryParameters().keySet());
        actionUsage(usage, action).initResponseCodes(action.getResponses().keySet());
        actionUsage(usage, action).initRequestHeaders(action.getHeaders().keySet());
        if (action.getBody() != null) {
          for (final MimeType mimeType : action.getBody().values()) {
            if (mimeType.getFormParameters() != null) {
              UsageBuilder.mimeTypeUsage(usage, action, mimeType).initFormParameters(mimeType.getFormParameters().keySet());
            }
          }
        }
        for (final Map.Entry<String, Response> responseEntry : action.getResponses().entrySet()) {
          responseUsage(usage, action, responseEntry.getKey()).initResponseHeaders(responseEntry.getValue().getHeaders().keySet());
        }
      }
      createTotalUsage(usage, resourceEntry.getValue().getResources());
    }
  }
}

代码示例来源:origin: org.raml/raml-jaxrs-codegen-core

Map<String, MimeType> body = a.getBody();
if (body != null) {
  for (MimeType mt : body.values()) {

代码示例来源:origin: guru.nidi.raml/raml-doc-client

@Override
  public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException {
    final Action a = (Action) o;
    switch (propertyName) {
      case "securitySchemes":
        if (a.getSecuredBy() != null && !a.getSecuredBy().isEmpty()) {
          return a.getSecuredBy();
        }
        if (a.getResource().getSecuredBy() != null && !a.getResource().getSecuredBy().isEmpty()) {
          return a.getResource().getSecuredBy();
        }
        if (raml.getSecuredBy() != null && !raml.getSecuredBy().isEmpty()) {
          return raml.getSecuredBy();
        }
        return Collections.emptyList();
      case "type":
        return a.getType().toString();
      case "responses":
        return new TreeMap<>(a.getResponses());
      case "queryParameters":
        return new TreeMap<>(a.getQueryParameters());
      case "headers":
        return new TreeMap<>(a.getHeaders());
      case "body":
        return a.getBody() == null ? null : new TreeMap<>(a.getBody());
      default:
        return super.getProperty(interp, self, o, property, propertyName);
    }
  }
}

代码示例来源:origin: nidi3/raml-tester

private void action(Action action) {
  locator.action(action);
  checker.parameters(action.getBaseUriParameters(), BASE_URI);
  checker.parameters(action.getQueryParameters(), QUERY);
  checker.headerPattern(action.getHeaders().keySet());
  checker.description(action.getDescription());
  checker.description(action.getBaseUriParameters(), BASE_URI);
  checker.description(action.getQueryParameters(), QUERY);
  checker.description(action.getHeaders(), HEADER);
  checker.empty(action);
  if (action.getBody() != null) {
    for (final MimeType mimeType : action.getBody().values()) {
      locator.requestMime(mimeType);
      mimeType(mimeType);
    }
  }
  for (final Map.Entry<String, Response> entry : action.getResponses().entrySet()) {
    locator.responseCode(entry.getKey());
    response(entry.getValue());
  }
}

代码示例来源:origin: amazon-archives/aws-apigateway-importer

for (Map.Entry<String, MimeType> entry : action.getBody().entrySet()) {
      final String mime = entry.getKey();
      final String modelName = createModel(api, mime, entry.getValue());
  cleanupMethodModels(method, action.getBody());
} else {
  LOG.info(format("Creating method for api id %s and resource id %s with method %s", api.getId(), resource.getId(), httpMethod));
    for (Map.Entry<String, MimeType> entry : action.getBody().entrySet()) {
      final String mime = entry.getKey();
      final String modelName = createModel(api, mime, entry.getValue());

代码示例来源:origin: com.sap.cloud.yaas.service-generator/service-generator-model-raml

if (source.getBody() != null)
  final MimeType requestBody = source.getBody().get(bodyType);
  builder.parameters(transformBodyParam(context, source, requestBody, ctx));
if (source.getBody() != null && !source.getBody().isEmpty())

代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform

LOGGER.log(Level.WARNING, "Error when writting sample.", e);
action.getBody().put(mediaType, ramlInRepresentationWithMediaType);

代码示例来源:origin: org.restlet.gae/org.restlet.ext.platform

LOGGER.log(Level.WARNING, "Error when writting sample.", e);
action.getBody().put(mediaType, ramlInRepresentationWithMediaType);

代码示例来源:origin: org.restlet.jse/org.restlet.ext.platform

LOGGER.log(Level.WARNING, "Error when writting sample.", e);
action.getBody().put(mediaType, ramlInRepresentationWithMediaType);

代码示例来源:origin: org.restlet.jee/org.restlet.ext.apispark

LOGGER.log(Level.WARNING, "Error when writting sample.", e);
action.getBody().put(mediaType, ramlInRepresentationWithMediaType);

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.platform

LOGGER.log(Level.WARNING, "Error when writting sample.", e);
action.getBody().put(mediaType, ramlInRepresentationWithMediaType);

代码示例来源:origin: nidi3/raml-tester

public void checkRequest(RamlRequest request, Action action, SecurityExtractor security) {
  checkQueryParameters(request.getQueryValues(), action, security);
  checkRequestHeaderParameters(request.getHeaderValues(), action, security);
  final MediaTypeMatch typeMatch = MediaTypeMatch.find(requestViolations, request, action.getBody(), locator);
  if (typeMatch != null) {
    locator.requestMime(typeMatch.getMatchingMime());
    if (FormDecoder.supportsFormParameters(typeMatch.getTargetType())) {
      checkFormParameters(action, request.getFormValues(), typeMatch.getMatchingMime());
    } else {
      checkSchema(requestViolations, request.getContent(), typeMatch);
    }
  }
}

相关文章