![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@mittwald/api-code-generator
Advanced tools
Common code base used by @mittwald/api-client-*
package.
Use the CLI commands provided by this package to build your API client and validate the OpenAPI-Spec:
acg validate spec/openapi.json
acg generate --name MittwaldAPIV2 spec/openapi.json src/generated --optionalHeader x-access-token
If you need to generate the client in code, you can use the TypeScript API demonstrated in this template:
import * as path from "path";
import { UniversalContentLoader } from "@mittwald/api-code-generator/js";
import { UniversalFileLoader } from "@mittwald/api-code-generator/js";
import { OpenApiSpec } from "@mittwald/api-code-generator/js";
import { CodeGenerationModel } from "@mittwald/api-code-generator/js";
import { prepareTypeScriptOutput } from "@mittwald/api-code-generator/js";
import { writeIfChangedAsync } from "@mittwald/api-code-generator/js";
const name = "MittwaldAPIV2";
const inout = `${process.cwd()}/spec/openapi.json`;
const output = `${process.cwd()}/src/generated`;
// Loading OpenAPI spec
const loader = new UniversalContentLoader(new UniversalFileLoader(input));
const openApiDoc = await loader.load();
// Parsing OpenAPI spec
const spec = await OpenApiSpec.parse(openApiDoc, {
skipValidation: flags.skipValidation,
});
// Building transformation model
const model = CodeGenerationModel.fromDoc(name, spec.document);
// Generating descriptors
const descriptorsFileContent = model.paths.compileDescriptors();
await writeIfChangedAsync(
path.join(output, "descriptors.ts"),
await prepareTypeScriptOutput(descriptorsFileContent),
);
// Generating types
const typesFileContent = await model.compileTypes({
rootNamespace: flags.name,
optionalHeaders: ["x-access-token"],
});
await writeIfChangedAsync(
path.join(output, "types.ts"),
await prepareTypeScriptOutput(typesFileContent),
);
// Generating client
const clientFileContent = model.paths.compileClient();
await writeIfChangedAsync(
path.join(output, "client.ts"),
await prepareTypeScriptOutput(clientFileContent),
);
// if needed: Generating React client
const reactClientFileContent = model.paths.compileReactClient();
await writeIfChangedAsync(
path.join(output, "client-react.ts"),
await prepareTypeScriptOutput(reactClientFileContent),
);
FAQs
Unknown package
We found that @mittwald/api-code-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.