Skip to content

Commit

Permalink
feat(cbor): create cbor class stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed May 14, 2024
1 parent 534128e commit 446c0d9
Show file tree
Hide file tree
Showing 5 changed files with 223 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.typescript.codegen.protocols.cbor;

import software.amazon.smithy.model.traits.TimestampFormatTrait;
import software.amazon.smithy.typescript.codegen.integration.DocumentMemberDeserVisitor;
import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator;

public class CborMemberDeserVisitor extends DocumentMemberDeserVisitor {

/**
* Constructor.
*
* @param context The generation context.
* @param dataSource The in-code location of the data to provide an output of
* ({@code output.foo}, {@code entry}, etc.)
* @param defaultTimestampFormat The default timestamp format used in absence
* of a TimestampFormat trait.
*/
public CborMemberDeserVisitor(ProtocolGenerator.GenerationContext context,
String dataSource,
TimestampFormatTrait.Format defaultTimestampFormat) {
super(context, dataSource, defaultTimestampFormat);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.typescript.codegen.protocols.cbor;

import software.amazon.smithy.model.traits.TimestampFormatTrait;
import software.amazon.smithy.typescript.codegen.integration.DocumentMemberSerVisitor;
import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator;

public class CborMemberSerVisitor extends DocumentMemberSerVisitor {

/**
* Constructor.
*
* @param context The generation context.
* @param dataSource The in-code location of the data to provide an input of
* ({@code input.foo}, {@code entry}, etc.)
* @param defaultTimestampFormat The default timestamp format used in absence
* of a TimestampFormat trait.
*/
public CborMemberSerVisitor(ProtocolGenerator.GenerationContext context,
String dataSource,
TimestampFormatTrait.Format defaultTimestampFormat) {
super(context, dataSource, defaultTimestampFormat);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.typescript.codegen.protocols.cbor;

import software.amazon.smithy.model.shapes.CollectionShape;
import software.amazon.smithy.model.shapes.DocumentShape;
import software.amazon.smithy.model.shapes.MapShape;
import software.amazon.smithy.model.shapes.StructureShape;
import software.amazon.smithy.model.shapes.UnionShape;
import software.amazon.smithy.typescript.codegen.integration.DocumentShapeDeserVisitor;
import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator;

public class CborShapeDeserVisitor extends DocumentShapeDeserVisitor {

public CborShapeDeserVisitor(ProtocolGenerator.GenerationContext context) {
super(context);
}

@Override
protected void deserializeCollection(ProtocolGenerator.GenerationContext context, CollectionShape shape) {

}

@Override
protected void deserializeDocument(ProtocolGenerator.GenerationContext context, DocumentShape shape) {

}

@Override
protected void deserializeMap(ProtocolGenerator.GenerationContext context, MapShape shape) {

}

@Override
protected void deserializeStructure(ProtocolGenerator.GenerationContext context, StructureShape shape) {

}

@Override
protected void deserializeUnion(ProtocolGenerator.GenerationContext context, UnionShape shape) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.typescript.codegen.protocols.cbor;

import software.amazon.smithy.model.shapes.CollectionShape;
import software.amazon.smithy.model.shapes.DocumentShape;
import software.amazon.smithy.model.shapes.MapShape;
import software.amazon.smithy.model.shapes.StructureShape;
import software.amazon.smithy.model.shapes.UnionShape;
import software.amazon.smithy.typescript.codegen.integration.DocumentShapeSerVisitor;
import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator;

public class CborShapeSerVisitor extends DocumentShapeSerVisitor {

public CborShapeSerVisitor(ProtocolGenerator.GenerationContext context) {
super(context);
}

@Override
protected void serializeCollection(ProtocolGenerator.GenerationContext context, CollectionShape shape) {

}

@Override
protected void serializeDocument(ProtocolGenerator.GenerationContext context, DocumentShape shape) {

}

@Override
protected void serializeMap(ProtocolGenerator.GenerationContext context, MapShape shape) {

}

@Override
protected void serializeStructure(ProtocolGenerator.GenerationContext context, StructureShape shape) {

}

@Override
protected void serializeUnion(ProtocolGenerator.GenerationContext context, UnionShape shape) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.typescript.codegen.protocols.cbor;

import java.util.Set;
import software.amazon.smithy.model.shapes.OperationShape;
import software.amazon.smithy.model.shapes.Shape;
import software.amazon.smithy.model.shapes.ShapeId;
import software.amazon.smithy.model.shapes.StructureShape;
import software.amazon.smithy.typescript.codegen.integration.HttpRpcProtocolGenerator;
import software.amazon.smithy.utils.SmithyInternalApi;


/**
* Generator for Smithy RPCv2 CBOR.
*/
@SmithyInternalApi
public class SmithyRpcV2Cbor extends HttpRpcProtocolGenerator {

public SmithyRpcV2Cbor() {
super(true);
}

@Override
protected String getDocumentContentType() {
return "";
}

@Override
protected void generateDocumentBodyShapeSerializers(GenerationContext generationContext, Set<Shape> set) {

}

@Override
protected void generateDocumentBodyShapeDeserializers(GenerationContext generationContext, Set<Shape> set) {

}

@Override
protected String getOperationPath(GenerationContext generationContext, OperationShape operationShape) {
return "";
}

@Override
protected void serializeInputDocument(GenerationContext generationContext,
OperationShape operationShape,
StructureShape structureShape) {

}

@Override
protected void writeErrorCodeParser(GenerationContext generationContext) {

}

@Override
protected void deserializeOutputDocument(GenerationContext generationContext,
OperationShape operationShape,
StructureShape structureShape) {

}

@Override
public ShapeId getProtocol() {
return null;
}

@Override
public void generateProtocolTests(GenerationContext generationContext) {

}
}

0 comments on commit 446c0d9

Please sign in to comment.